159k views
5 votes
Write a complete program that reads a string and displays the vowels. The vowels are A, E, I, O, U and a, e, i, o, u. Here are three sample runs:Sample Run 1Enter a string: Welcome to PythonThe vowels are eoeooSample Run 2Enter a string: Student UnionThe vowels are ueUioSample Run 3Enter a string: AREIOUaeiouRTEThe vowels are AEIOUaeiouENote: your program must match the sample run exactly.using python

1 Answer

4 votes

text = input("Enter a string: ")

new_text = ""

vowels = "aeiou"

for x in text:

if x.lower() in vowels:

new_text += x

print(new_text)

I hope this helps!

User OpenSorceress
by
4.4k points