Multiple choice Quiz

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 attache screenshot also.
any advice welcome!

I feel like you should put this into the “Users” Category. Ideas is more for the new things you would like to add into Python.

As for your problem, try running your script from your terminal. It should fix the individual line issue. (I’m pretty sure pycharm has some way of fixing it but I don’t know it :))

I am not sure what you mean by “registering questions in function”. Could you attach the entire file using markdown notation or using pastebin? Markdown notation works like this:
```python
Your code here
```

Moved to Users.

A

Your file does say “assignment” – I’m not sure your professor would be happy you getting someone else to do your homework for you! Also, people volunteer to give help for free here, so do be respectful of that vis a vis giving copyable code that we can debug ourselves.

A hint: note question_prompts has no relation to the question variable you are looping over. You probably want to use an attribute of that class.

A

2 Likes

Hi Adam,
Thank you for responding.
I’m actually self-teaching myself python but should probably change the file so the wrong incorrect assumptions are made.

To clarify, my for loop isn’t accessing my question class?
If so do I need to change the variable question_prompts or do I need to revisit my class?

Kind regards
Jay