I'm trying to make a quiz game with multiple choice (4 choices). So far I've made a simple quiz containing just one question. I cannot wrap my head around a good way to index the questions.
The plan is to expand my quiz with at least 500 questions, and randomly pick a question from the question pool. How should I structure it?
This is what I've got so far in my one-question game:
def welcome(): #Introduction
print "Welcome to the quiz!"
print " "
print " "
def question(): # Question function
quest = { 'id' : 0, 'question' : "What is the capital of Belgium?" , 'a' : "Vienna" , 'b' : "Berlin" , 'c' : "Brussels" , 'd' : "Prague" , 'answer' : 'c'}
print quest['question']
print " "
print "A:", quest['a'],
print "B:", quest['b'],
print "C:", quest['c'],
print "D:", quest['d']
guess=raw_input("Your guess: ")
if guess == quest['answer']:
print " "
print "Correct!!!"
else:
print " "
print "Sorry, that was just plain wrong!"
welcome()
question()