Project : Quiz Game with Python
We don’t need any package or module for this task as I will only use the basic python for building this quiz.
Let's go through program step by step:
-
While thinking about a quiz, the first thing that comes in mind is options, now as a python programmer, I will build a function so that we can easily give the options as parameters while defining every new question. By defining the function for giving options it will save a lot of code in the process. So every time a problem hits you make a solution in your mind and then try to code as less as possible. This will build your ability to build algorithms.
-
Pass a print statement to welcome us in the quiz game and I will take a user input that whether the user is ready or not. Then I will set the initial score as 0, and set the total number of questions as 4.
-
As the questions are already in my mind so I will first create a list of correct answers so that we can verify the correct answers in the process of the quiz game by using the list indexing method in Python.
-
I will simply start with building questions for our quiz game, after defining every question I will use the function that I defined at the beginning to give the three options for the question.
-
After every answer whether correct or incorrect the user will be passed to the next question.
-
Now as we are done with the questions it’s time to show the scores to the user. I will multiply the score with 10 and then I will pass the if-else conditionals to print the status of the result of this Quiz game.