Option 3 – More than one right answer
Sometimes you need to allow more than one correct answer to a question.
This is quite easy to do, but you need to be a little careful.
The key is to use the or command.
![Code helper image](quiz2/q4or.png)
- Start by entering your question and getting an answer
Don't forget to use .lower() to make checking the answer easier
- Then in the if line you have to add more than one correct answer using or to tell the program to accept the first answer OR the second answer
- You can add more correct answers if you want to. Just separate them with or each time
- Run your code to check that it works
You can do this with any type of question.
Of couse, this still relies on the user being able to spell piccadilly correctly. Which isn't super easy. It's one of the things that makes text answers much harder to code.