尝试使用while循环并得到相同的错误
show_name = str(input("Please Enter Show Name: ")).upper()
if show_name in ['SEINFELD', 'JERRY SEINFELD', 'THE SEINFELD SHOW', 'JERRY']:
while True:
seinfeld_keywords = (str(input("Please Enter Seinfeld Keywords: "))).upper()
if not seinfeld_keywords:
print("Sorry, %s Is Not Currently Available. Please Check Back Soon!" %show_name)
continue
这个脚本是用来问用户他们感兴趣的电视节目。如果它不是(在这一点上),宋飞,它应该打印“显示X是不可用的。”我已经得到了工作,但我希望脚本,然后重新开始,并要求另一个显示输入。有什么建议吗?你知道吗
show_name = str(input("Please Enter Show Name: ")).upper()
if show_name in ['SEINFELD', 'JERRY SEINFELD', 'THE SEINFELD SHOW', 'JERRY']:
seinfeld_keywords = (str(input("Please Enter Seinfeld Keywords: "))).upper()
else:
print("Sorry, %s Is Not Currently Available. Please Check Back Soon!" %show_name)
continue
你需要一段时间。我还对您的代码稍微进行了重组,使其更加清晰:
相关问题 更多 >
编程相关推荐