vendredi 27 novembre 2015

How to make a variable equate to another variable (Python)

I don't even know how to explain this one.

Question1 = "a" 
Question2 = "b" 
Question3 = "c" 
Question4 = "d"
Question5 = "e"

etc.

Answer1 = "a" 
Answer2 = "b" 
Answer3 = "c" 
Answer4 = "d" 
Answer5 = "e"

etc.

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()

etc.

print("")
print(Question)
print("")
key = raw_input()
if(key == Answer):
    print("Correct!")
    time.sleep(1)
    QuestionPicker()

(all are within functions)

Problem is Python won't print the variable Question, and no error comes up, just when it should be printed it is blank. 'Answer is successfully changed, Question isn't or won't be printed.




Aucun commentaire:

Enregistrer un commentaire