1 回答
TA贡献1802条经验 获得超6个赞
我不确定你想要什么,但这满足了你的评论所要求的最低限度:
questionsList = []
rightAnswersList = []
choicesList = []
while True:
option = int(input("Add questions or take the quiz? 1 or 2 respectively: "))
if option == 1:
questionsList.append(input("Enter question: "))
choices = []
while True:
choice = input("Enter answer choice or enter 'q' to exit: ")
if choice == "q":
break
choices.append(choice)
choicesList.append(choices)
rightAnswersList.append(input("Enter answer: "))
elif option == 2:
for i in range(len(questionsList)):
print(questionsList[i])
print("Choices:\n" + "\n".join(choicesList[i]))
answer = input("Enter your answer: ")
print("Your answer is: " + answer)
print("Correct answer is: " + rightAnswersList[i])
您可能需要添加额外的代码来过滤用户输入或检查用户答案。
添加回答
举报