Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use only python program to answer. Kindly include code and screenshot of output to help with understanding. 06.1 - Math Quiz Write a function

Please use only python program to answer. Kindly include code and screenshot of output to help with understanding.image text in transcribed

06.1 - Math Quiz Write a function named random_factor that returns a random integer. The function should have one argument which specifies how many digits the random number it returns should have. Then use this function in a program that gives the user a simple division problem to solve as shown below. The main function of your program should use your randon factor function to generate a random 2 digit factor and a random 1 digit factor. The numerator of the division problem should be the product of these factors. The denominator should be the 1 digit factor. For example, if the factors are 33 and 6 , the numerator is 198 , the denominator is 6 , and the correct answer is 33. 1986 The program should then allow the user to enter the answer. If their answer is correct, a message of congratulations should be displayed. If their answer is incorrect, a message showing the correct answer should be displayed. Finally, format your program to match the samples below. Since the numbers should be randomly generated from your own code, your program will display different digits than those shown in the sample. User input in the sample has been highlighted in Pappy's Purple to distinguish it from the program's output, but your user input does not need to be colored. Save your program as math_quiz_login. py, where login is your Purdue login. Then submit it along with a screenshot showing 3 test runs. Be sure to include both correct and incorrect results in your screenshot. Terminal $ python math_quiz_login. py 25 1 =0 Sorry, the correct answer is 25 . $ python math_quiz_login.py 148 +2 -74 Great job, that's correct! $ python math_quiz_login. py 388 +4 - 4 . =392 Sorry, the correct answer is 97. Notes - The Unicode value for the division symbol () is lu00F7. You can enter this value into a python string like this Terminal $ python >>exit()

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

Students also viewed these Databases questions