however = ["In converse","On the other hand"]
furthermore = ["To add insult to injury","To add fuel to fire",]
conclusion = ["To ram the point home","In a nutshell"]
def prompt():
answer = str(input("Type either 'however','furthermore' or 'conclusion': "))
return answer
reply()
def reply():
if answer == "however":
print(however)
elif answer == "furthermore":
print(furthermore)
elif answer == "conclusion":
print(conclusion)
else:
prompt()
prompt()
prompt()
发生了什么事?当我输入任何东西时它只是不打印 它只是跳过并且根本不打印任何东西
答案 0 :(得分:1)
您的reply()函数将不会被调用,因为您通过返回答案退出prompt()函数
以下是如何做到的:
however = ["In converse","On the other hand"]
furthermore = ["To add insult to injury","To add fuel to fire",]
conclusion = ["To ram the point home","In a nutshell"]
def prompt():
answer = str(input("Type either 'however','furthermore' or 'conclusion': "))
reply(answer)
return answer
def reply(answer):
if answer == "however":
print(however)
elif answer == "furthermore":
print(furthermore)
elif answer == "conclusion":
print(conclusion)
else:
prompt()
prompt()
prompt()