私のコードの一部です。ユーザーが間違っていると言い続けます。各質問への答えは、リスト内で同じ順序です。Pythonの乱数に問題があります
質問銀行
questions = ["45 - 20","32 - 12","54 + 41"]
# Answer Bank
answers = ["25","20","95"]
while qleft != 0:
# Get random question
qnumber = randint(0,2)
currentquestion = questions[qnumber]
currentanswer = answers[qnumber]
# Question
userchoice = int(input("What does {} equal? ".format(currentquestion)))
# Check Answer
if userchoice != currentanswer:
print("Incorrect")
qleft -= 1
elif userchoice == currentanswer:
print("Correct")
qleft -= 1
else:
print("That's not a valid answer")
整数 'の古典的なケースのように見える!=私にSTRING' ... – Shadow