Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2 . . Write a program (named math_quiz.py) that provides simple math problems to quizzes a student's ability to perform addition and multiplication. Your

image text in transcribed

Problem 2 . . Write a program (named math_quiz.py) that provides simple math problems to quizzes a student's ability to perform addition and multiplication. Your program has the additional requirements The program shall display a message to the user explaining what the program does. The program shall display a menu where the user can select the type of problems they want. For example 1) Addition problems only 2) Multiplication problems only 3) Random addition & multiplication problems 4) Exit program The program shall display two random numbers from 0 to 100 The program shall present the user with 10 questions of the type they selected. The problems will be formatted and presented to the user in the format: 27 + 19 = After the 10 problems are answered, the program shall display the number of questions answered correctly and the score as a percentage. The program shall return to the menu after summary has been displayed. The program shall NOT display the original display message explaining what the program does. The program shall have the following functions main(): This function is the main codeline and will call all other functions. . display_menu() This function will display the menu to the user get_menu_option(): This function will prompt the user for a menu choice and return a valid option to the calling program. display_problem(num1, num2, operation): This function will accept two numbers and an operator to display the problem to the user. . get_random_number(lower_limit, upper_limit): This function returns a random number bounded by the lower and upper limits. get_user_answer(); This function returns users answer to the problem . display_result(correct_answer, user_answer): This function accepts the correct answer and the user answer to determine the appropriate message to display to the user. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed. display_score (problems_answered_correctly, total_problems): This function accepts the number of questions answered correctly and the total number of problems presented to display a user's summary score. Hint: To generate a random operation, use a random number between 0 and 1. Assign 0 to addition and 1 to multiplication

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

What is the multiple correlation Rxy?

Answered: 1 week ago

Question

=+7. What tools does the writer use to reinforce his position?

Answered: 1 week ago