0% found this document useful (0 votes)
2 views1 page

Example 5

The document provides a program that counts and prints the number of vowels in a user-input string. It initializes a vowel counter and iterates through each character to check if it is a vowel. The output displays the total number of vowels found in the input string.

Uploaded by

rishiyadav47900
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Example 5

The document provides a program that counts and prints the number of vowels in a user-input string. It initializes a vowel counter and iterates through each character to check if it is a vowel. The output displays the total number of vowels found in the input string.

Uploaded by

rishiyadav47900
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Example 5: Write a program to count and print number of vowels in

a string.

# Take the input string form the user

String=input(“Enter string:”)
vowels=0

For i in string:
if(i== ‘a’ or i== ‘e’ 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)

OUTPUT:

Enter string: Amsterdam


Number of vowels are:
3

You might also like