Computer Science, asked by Akankshya5, 10 months ago

wap in python to count no.of vowels in a list.can anyone tell me what is wrong in my program.As it is giving a is not defined ie error in 3rd line.​

Attachments:

Answers

Answered by bktbunu
2

Answer:

make the following modification.

l = ['a', 'e', 'i', 'o', 'u']

I have also added capital letters for vowels.

Explanation:

Corrected Program

count = 0

st = input("Enter a string:")

l = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']

for ele in st:

if ele in l:

count = count + 1

print("The number of vowels in the string is:", count)

Similar questions