+ 2

Trying Challenge to count vowels, but second test is failing can anyone tell me what's wrong?

Link: https://www.sololearn.com/coach/80?ref=app My Code: s = input() n = 0 for i in s: if i=='a' or i=='e' or i=='i' or i=='o' or i=='u': n+=1 print(n) Test question failing: Is there life on Mars? It's giving me 6 with my code but and should be 7! Can anyone help me here? What's wrong?

24th Mar 2024, 4:10 PM
BlackSpectrum
BlackSpectrum - avatar
4 ответов
+ 6
BlackSpectrum , when you are counting vowels, make sure that also *uppercase* vowels are counting. instead of checking each letter against the vowels, we can use the `in` operator like: if letter.lower() in 'aeiou':
24th Mar 2024, 4:19 PM
Lothar
Lothar - avatar
+ 2
Why not troubleshoot your code? If there is more than 1 vowel, what does you code do? What else could go wrong?
24th Mar 2024, 4:17 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
BlackSpectrum , Thanks for putting the link to the task description in your question body.
25th Mar 2024, 5:35 AM
Rain
Rain - avatar
+ 2
Lothar, Thanks forgot about upper case, my bad
25th Mar 2024, 6:55 AM
BlackSpectrum
BlackSpectrum - avatar