+ 2
Want to create a python program help
I want to make a program that counts the number of vowels in a given text. The vowels are a, e, i, o, and u. It has to take a string as input and output the number of vowels. Please correct this txt = input() vowels = ['a', 'e', 'i', 'o', 'u'] novowels = 0 for vowels in txt: novowels += 1 print(novowels) How to iterate over the target string char and test for each if is vowel or not
7 Respostas
+ 5
for chr in txt:
if chr in vowels:
novowels += 1
+ 2
where is your attempt?
tip: there are many ways to do it...
simplest is to iterate over the target string char and test for each if is vowel or not ;)
+ 2
Simba
yes, thanks: corrected ^^
+ 1
thanks all
+ 1
"we" have created ^^
0
https://code.sololearn.com/c18HTJ3XAjQu/?ref=app
here is the program i created
0
yes thanks again