from time import sleep
questions = (
#("question", (answers), index_of_correct_answer),
("What is the name of the nearest star?", ("Venus", "Sun", "Moon"), 1),
("What is the name of the capital city of Sweden?", ("Oslo", "Paris", "Stockholm", "Helsinki"), 2),
)
print()
print("Trivia game! (Ctrl+C to exit)")
print()
for question, answers, correct in questions:
print()
print(question)
for num, answer in enumerate(answers):
print(num+1, answer)
print()
player_answer = input("Enter the number of the answer: ")
sleep(2)
print()
if player_answer == str(correct + 1):
print("You are right!")
else:
print("Not correct.")
print("The answer is", answers[correct])
print()
sleep(5)
Source code of Trivia Game (trivia.py).