Ruben Ruben - 2 months ago 12
Python Question

Print only vowels in a string

I am new in Python and I'm trying to print all the vowels in a string. So if someone enters "Hey there, everything alright?" , all vowels needs to be printed...but I don't know how? (so it's not about counting the vowels, its about printing the vowels)

For now I've got this ;

sentence = input('Enter your sentence: ' )

if 'a,e,i,o,u' in sentence:
print(???)

else:
print("empty")

Answer

Something like this?

sentence = input('Enter your sentence: ' )
for letter in sentence:
    if letter in 'aeiou':
        print(letter)
Comments