如何在完成一轮操作后继续要求用户输入?

  • 本文关键字:继续 用户 操作 一轮 python
  • 更新时间 :
  • 英文 :


我有一个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!")

相关内容

最新更新