我有一个python脚本,消除了打印出元音在一个词(丑陋的元音吞噬)。我的意思是让用户在检查了前一个单词后输入一个新单词。请帮我解决这个问题,我已经附上了下面的代码。
多谢!
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!")