-1
我甚至不知道如何解释这一个。如何使变量等于另一个变量(Python)
Question1 = "a"
Question2 = "b"
Question3 = "c"
Question4 = "d"
Question5 = "e"
等
Answer1 = "a"
Answer2 = "b"
Answer3 = "c"
Answer4 = "d"
Answer5 = "e"
等
questioninteger = random.randint(1,20)
if(questioninteger == 1):
Boolean1 = True
Question == Question1
Answer == Answer1
FlashCard()
if(questioninteger == 2):
Boolean2 = True
Question == Question2
Answer == Answer2
FlashCard()
if(questioninteger == 3):
Boolean3 = True
Question == Question3
Answer == Answer3
FlashCard()
等
print("")
print(Question)
print("")
key = raw_input()
if(key == Answer):
print("Correct!")
time.sleep(1)
QuestionPicker()
(所有都是函数内)
问题是Python不会更改变量问题,并且不会出现错误。 '答案已成功更改,'问题'不会。
你有平等检查(如'问题== Question3'),而不是任务。更改为分配并重试。 – Netch
它也看起来像你会受益于查找如何使用['dicts'](https://docs.python.org/2/library/stdtypes.html#mapping-types-dict) –
感谢耶稣为你,有用。原来我早些时候尝试过,但没有全球化问题。再次感谢 – oisinvg2001