for a in list:
answer_or_help = False
print(a.question)
while answer_or_help not in ("q", "a"):
answer_or_help = input("Press a for Answer, h for Help, q to quit: ")
if answer_or_help == "h":
print(a.hint)
elif answer_or_help == "a":
print(a.answer)
elif answer_or_help != "q":
print("This is not a valid answer")
else:
if answer_or_help == "q":
break
当我输入“q”时,我试图退出 FOR 循环,但我不确定这是最好的方法。
我将不胜感激任何帮助。谢谢你!!
梦里花落0921
阿波罗的战车
幕布斯7119047
相关分类