How to ask for user input cotinuously after finishing one round of opetation?
Question:
i’ve got a python script that eliminates the print out of vowels inside a word (the ugly vowel eater). I meant to let the user input a new word once the previous word is examed. Please help me with that, i’ve attaced the code below.
Many thanks!
user_word = input("Please enter a word: ")
user_word = user_word.upper()
while True:
if user_word != "END":
for letter in user_word:
if letter == "A":
continue
elif letter == "E":
continue
elif letter == "I":
continue
elif letter == "O":
continue
elif letter == "U":
continue
else:
print (letter)
break
print ("Thanks for using the ugly vowel eater!")
Answers:
while True:
# take user input in the while loop
user_word = input("Please enter a word: ")
user_word = user_word.upper()
if user_word != "END":
for letter in user_word:
if letter == "A":
continue
elif letter == "E":
continue
elif letter == "I":
continue
elif letter == "O":
continue
elif letter == "U":
continue
else:
print (letter)
# make use of else clause to terminate loop only when END was given as input
else:
break
print ("Thanks for using the ugly vowel eater!")
i’ve got a python script that eliminates the print out of vowels inside a word (the ugly vowel eater). I meant to let the user input a new word once the previous word is examed. Please help me with that, i’ve attaced the code below.
Many thanks!
user_word = input("Please enter a word: ")
user_word = user_word.upper()
while True:
if user_word != "END":
for letter in user_word:
if letter == "A":
continue
elif letter == "E":
continue
elif letter == "I":
continue
elif letter == "O":
continue
elif letter == "U":
continue
else:
print (letter)
break
print ("Thanks for using the ugly vowel eater!")
while True:
# take user input in the while loop
user_word = input("Please enter a word: ")
user_word = user_word.upper()
if user_word != "END":
for letter in user_word:
if letter == "A":
continue
elif letter == "E":
continue
elif letter == "I":
continue
elif letter == "O":
continue
elif letter == "U":
continue
else:
print (letter)
# make use of else clause to terminate loop only when END was given as input
else:
break
print ("Thanks for using the ugly vowel eater!")