DEV Community

Cover image for Who wants to be a Millionaire? - Basic Starter Game
Jason Garcia
Jason Garcia

Posted on

Who wants to be a Millionaire? - Basic Starter Game

Hey everyone,

I created a basic starter game based off the game show "Who wants to be a millionaire?" for my python project to finish off the course on Codeacademy.

I went with this because it seemed fun to do while at the same time it felt like a good way to utilize a lot of the crucial parts that were taught throughout the course.

The game only has a total of 15 questions and shows the value of each question just like the game show.

Here is a link for for my code in
github:
https://github.com/jmgarci9/Questions/blob/main/Increase%20Space%20under%20Money%20class

As you'll see I created a class for the questions, as well as seperate classes for the different answer options, the answer input and the level value for each question. After all the classes section, I created a while loop that loops 15 times or less based off the 15 questions that are inserted into the code.

Inside the loop, a random number generator was created from 1 to 15 to randomly select one of the 15 questions from the code. That's where I also call all of the classes starting with the money class to display the value of the question. Then calling the Question class, followed by the AnswerChoices class. And last the code for the input from the user which is used for an argument within the the PlayerAnswer class.

All questions and answers in the classes used a dictionary to store the information and pull out the information. The count variable towards the end of the code is used to determine what level of question the user is on and used only for Money Class to indicate the value of the question.

In conclusion, even though the python project could be created in any way, my main focus was to used a lot of classes depicting the necessary portions for each code. That way it could become easier to understand for the code user.

Top comments (0)