Multiple choice game

Hi All,

I am currently trying to build a multiple choice quiz(Guess the capital cities).
To do so I have created a class called Question which has to two attributes:

  1. the question
  2. the answer.

I have then created a variable = to this class which stores the answers to the above class.

I have then created. a function to loop through each question however this does not appear to be working.

2 issues:

  1. The questions don’t appear on individual lines.
  2. It doesn’t appear to be registering the questions in function.

I have attached screenshot also.
any advice welcome!

please see my code:

  1. from classes import Question
  • question_prompts = [
  1. “What is the capital of France?\na. Paris \nb. Nice \nc. Lille\n\n”,

  2. “What is the capital of Germany?\na. Munich \nb. Berlin \nc. Frankfurt\n\n”,

  3. “What is the capital of Jamaica?\na.Portmore \nb.Montego Bay \nc. Kingston\n\n”,

  4. "What is the capital of Poland?\na.Warsaw \nb.Krakow \nc.Sopot\n\n ",

  5. “What is the capital of Brasil?\na.Brasilia \nb.Rio de janeiro \nc.Sao Paulo\n\n”,

  6. “What is the capital of South Africa?\na.Cape town \nb.Pretoria \nc.Johannesburg\n\n”,

  7. “What is the capital of Kenya?\na.Mombasa \nb.Nairobi \nc.Malindi\n\n”,

  8. “What is the capital of Spain?\na.Barcelona \nb.Madrid \nc.Valencia\n\n”,

  9. “What is the capital of Italy?\na.Naples \nb.Milan \nc.Rome\n\n”,

  10. “What is the capital of India?\na.New Delhi \nb.Mumbai \ncBangalore\n\n”,

  11. ]

  • questions = [
  1. Question(question_prompts[0], “a”),

  2. Question(question_prompts[1], “a”),

  3. Question(question_prompts[2], “c”),

  4. Question(question_prompts[3], “a”),

  5. Question(question_prompts[4], “a”),

  6. Question(question_prompts[5], “a”),

  7. Question(question_prompts[6], “b”),

  8. Question(question_prompts[7], “b”),

  9. Question(question_prompts[8], “c”),

  10. Question(question_prompts[9], “a”),

  11. ]

  • def run_test(questions):

  • score = 0

  1. for question in questions:

  2. answer = input(question_prompts)

  3. if answer == question.answer:

  4. score += 1

  5. print(" You got " + str(score) + “/” + str(len(questions)) + “correct”)

  • run_test(questions)

Please, use pastebin or markdown notation (explanation in the previous topic). It is supposed to look like this:

# Code here
print("Hello World")

In order to help you, we might also need the Question class. Please, attach it as well.