Python Example | Find Vowels in a String

This python example code will show us how to find vowels in a python string.

# take input
string = input('Enter any string: ')
# to find the vowels
vowels = [each for each in string if each in "aeiouAEIOU"]

# print number of vowels in string
print('Number of vowels in string:', len(vowels))
# print all vowels in string