Hello mates, wanted to ask why do you think this prints my string and counts the vowels multiple times. Help would be greatly appreciated. Language is Python.
Can’t know for sure because the code provided lacks indentation. May probably something related to that too. I copy/pasted your code and corrected the indentation. It works correctly.
def vowel_count(str):
count = 0
vowel = set(“aeiou”)
for vowels in str:
if vowels in vowel:
count = count + 1
print("The amount of vowels is :", count)
str = "Jose can do it if he tries."
vowel_count(str)