Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python I am trying to create a trivia game that contains the following. A category selection and an answer calculator that gives how many

In Python I am trying to create a trivia game that contains the following. A category selection and an answer calculator that gives how many answers the player got right as a percentage as well as give a message for the percentage like, nice job or, needs work. I am requesting code for a small section where lets say it is 2 categories with 2 questions each. They do not have to be any particular questions they can be as simple as category 1 and question 1 with answers 1,2,3,4. It also needs an exit button to quit out of the program whenever as well as include these in it.

Additionally, the structure of your program should allow it to be used as a module. While this sounds daunting, it really means following these four rules:

1. All functionality that runs this application (loading the category content, running the game, displaying results, etc.) should all be isolated in functions using parameters and return values to handle the functionality.

2. No data will be kept in the global scope. That is, no variables will be defined indented to the far left.

3. Using a main() function to run the application will provide the "glue" that pulls together these features into a complete game.

4. The call to the main function needs to be guarded to prevent it from being called automatically when referenced through an import statement. This is a new concept being introduced here, but just follow the syntax:

if __name__ == "__main__": main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lords Of Finance The Bankers Who Broke The World

Authors: Liaquat Ahamed

1st Edition

0143116800, 978-0143116806

Students also viewed these Databases questions