I've got the following code that converts a list into a multiple choice quiz:
def practise_test(test):
score = 0
for question in test:
while True:
print(question[question])
reaction = input (question[options] + '\n')
if reaction == question[answer]:
print ('\nright answered!')
print('The answer is indeed {}. {}\n'.format(question[answer], question[explanation]))
score += 1
break
else:
print ('\nIncorrect answer.')
print ('The correct answer is {}. {}\n'.format(question[answer], question[explanation]))
break
print (score)
But now I have to add some code to the practise_test function so that when you type: 'previous' you go to the previous question. Anyone have an idea to fix this?
Aucun commentaire:
Enregistrer un commentaire