Whu is this Vowel counter program printing 29??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Whu is this Vowel counter program printing 29???

#your code goes here text=input() c="aeiou" n=0 for c in text: n=n+1 print(n)

9th Sep 2021, 3:30 PM
Tanu Jain
2 Answers
+ 6
Maybe because the the length of text is 29. Between this is not how you calculate vowel. "c" in "for c in text" is different from "c=aeiou". In the following line, "for c in text" , c is assigned next character of text on each iteration.
9th Sep 2021, 3:33 PM
Abhay
Abhay - avatar
+ 1
Hi Tanu! You can use another variable in for loop instead of c to run it. Then you can check whether it's included in c using if statement. Finally, you can print the output outside loop to get the total numbers of vowels.
9th Sep 2021, 5:43 PM
Python Learner
Python Learner - avatar