Computer Science, asked by prathamgupta129, 7 months ago

write a python program to count no. of vowels in a string.​

Answers

Answered by raiankush999
1

Answer:

1. Take a string from the user and store it in a variable.

2. Initialize a count variable to 0.

3. Use a for loop to traverse through the characters in the string.

4. Use an if statement to check if the character is a vowel or not and increment the count variable if it is a vowel.

5. Print the total number of vowels in the string.

6. Exit.

program:

string=raw_input("Enter string:")

vowels=0

for i in string:

if(i=='a' or i=='e' or i=='i' or i=='o' or i=='u' or i=='A' or i=='E' or i=='I' or i=='O' or i=='U'): vowels=vowels+1

print("Number of vowels are:")

print(vowels)

Similar questions