ready = input('Are you ready to start the quiz? [Y/N]: ')
if ready == "N":
quiz()
else:
questionsasked = []
qnum = random.randint(1,5)
questionsasked.append((qnum))
while (qnum)not in(questionsasked):
所以主要问题是我输入“Y”后我的程序不会继续,它只是在shell中停止而没有任何错误。 任何帮助,将不胜感激。提前致谢
答案 0 :(得分:3)
您的while
条件为false,因此您的程序结束。
questionsasked = []
qnum = random.randint(1,5)
questionsasked.append((qnum)) # added qnum to questionsasked
while (qnum)not in(questionsasked): # qnum is in questionsasked, so condition is false.
...