+ 1
Counting specific letter in string
How can I count number of a in "aioaeba"
3 Antworten
+ 8
Alternatively, you could use the string method count().
Example:
print("Lisa".count("i"))
+ 3
In python, you would use a loop to go through your letters and if the letter matches "a", add it to a counter and then print it.
e.g.
counter = 0
loop:
if letter == "a":
counter += 1
print(counter)
+ 1
Thank you Ausgrindtube and Lisa for help