用户输入基于if语句

时间:2016-02-23 17:58:51

标签: python

我正在尝试为大学项目进行测验。基本上,我希望人们只有在选择我希望他们选择的答案时才能进步。所以我选择使用"输入1作为答案,2为此答案。"

如果他们输入" 1"我希望它告诉他们这是错误的答案然后将他们回到相同的问题,以便他们有机会选择正确的答案,然后它将转到下一个问题。

请帮忙。 感谢。

这就是我现在所处的位置。

question1 = None
while question1 is not "2":
    question1 = simpledialog.askinteger("Question 1", "Would you rather benefit: \n\n(1) The Environment \n(2) The Economy")
    messagebox.showinfo("Nope!", "Wrong!")
question2 = None
while question2 is not "2":
    question2 = simpledialog.askinteger("Question 2", "Would you rather do something: \n\n(1) Mediocre and become famous \n(2) Great and take no credit.")
    messagebox.showinfo("Nope!", "Wrong!")

0 个答案:

没有答案