I am trying to create a random question generator for helping me to revise. I have the problem of when i enter my answer correctly or incorrectly I will get an output of false twice in succession.
Here is my code, at the bottom I have commented lines. They were for when I was only having the possibility of one answer, probably not needed but kept anyway.
import random
a = ('What is 1 + 2?')
b = ('What is 2 + 2?')
questions = [a, b]
answer = (int(input(random.choice(questions))))
answer = a
answer = b
if a == 3:
print('Correct')
else:
print ('False')
if b == 4:
print('Correct')
else:
print ('False')
#if answer == 2:
# print ('Well Done')
#else:
# print ('No Incorect')
Aucun commentaire:
Enregistrer un commentaire