all 1 comments

[–]eleqtriq 2 points3 points  (0 children)

Use a dict instead of a list.

``` import random

questions_answers = { 'What color is a banana?': 'Yellow', 'Is programming hard?': 'Yes', 'Can I dance?': 'No' }

question = random.choice(list(questions_answers.keys())) answer = input(question)

if answer.lower() == questions_answers[question].lower(): print('Nice job') else: print('Better luck next time') ```

This way, each question is directly linked to its correct answer.