Accessing Strings, python data structures | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Accessing Strings, python data structures

You need to make a program that counts the number of vowels in a given text. The vowels are a, e, i, o, and u. Take a string as input and output the number of vowels. Sample Input: this is great Sample Output: 4 My code: text = input() vowels = "a", "e", "i", "o", "o" count = 0 for x in text.lower(): if x in vowels: count += 1 print(count) Test case 3 won't accept my code. Why?

24th Sep 2022, 11:21 AM
Kim
Kim - avatar
2 Answers
+ 4
Double "o". You missing "u".
24th Sep 2022, 11:25 AM
Jayakrishna 🇮🇳
+ 2
Thank you my brain is a bit goofy today
24th Sep 2022, 11:31 AM
Kim
Kim - avatar