Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Write a function named random_factor that returns a random integer. The function should have one argument Notes  The Unicode value for the division symbol (+) is u00F7. You can enter this value into a python string

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 random_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. 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 show- ing 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 dis- tinguish 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 198 6 # Notes The Unicode value for the division symbol (+) is \u00F7. You can enter this value into a python string like this Terminal $ python >>>print("\u00F7") + >>> exit()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

It seems you want to create a Python program that generates math quiz questions and checks if the ... 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

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions