Write a function named random_factor that returns a random integer. The function should have one argument...
Fantastic news! We've located the answer you've been seeking!
Question:
Transcribed Image Text:
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()
Expert Answer:
Answer rating: 100% (QA)
It seems you want to create a Python program that generates math quiz questions and checks if the u View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions

Consider an ideal dualloop heatpowered refrigeration cycle using R134a as the working fluid, as shown in Fig. P9.135. Saturated vapor at 200 F leaves the boiler and expands in the turbine to the...

The adjusted trial balance of Kwun Company Inc. at December 31, 2011, includes the following accounts (in thousands): Share CapitalOrdinary W15,600: Dividends W6,000: Service Revenue W35,400:...

Part A. You are in charge of the Aurora Project. Given the following project network, baseline, and status information, develop status reports for periods 18 and complete the performance indexes...

Use integration by parts to compute the following definite integrals. Note that the equivalent indefinite integrals were considered in Example 6.9. Example 6.9 Use integration by parts to compute the...

Peltier Drycleaners has the capacity to clean up to 9,000 garments per month. Requirements 1. Complete the following schedule for the three volumes shown. 2. Why does the average cost per garment...

Make recommendations on the following for Amazon: Organizational form suitable for the ebusiness in the future. A suitable organizational culture for IT/IS led to change. In your answer, include...

Winemaker Modelling and Application (~500 words) A winemaker in Barossa Valley in South Australia must decide how much of two types of wine she will produce from a particular variety of grades. Each...

Doris is planning to purchase a new Toyota that costs $26,865. She has already saved $3,200 to put toward it. She is thinking if she wants to get a loan for it from her credit union Assume Doris puts...

Consider two events, A and B, of an experiment which is not empty. Display this information in a Venn diagram and shade the area representing the event {A or B}.

A farm household in rural Mexico consists of five adult brothers and no other dependents. Total annual income depends on the number of brothers working on the farm through the year and is given by...

What does the following Cypher query express? a. Return all of Barts friends, and their friends as well. b. Do not return Barts friends, but return their friends. c. Do not return Barts friends, but...

Five dice are rolled all at once. On each of the first four dice, the outcome is a 6. What is the probability that a 6 shows on the 5th dice?

Identify and provide an example of three common forms of ambush marketing.

2) For the circuit below, Vtn = 1 V and k = 4 mA/V?. Calculate i and determine the operation modes of the MOSFETS. 1 k2 2.5 V 100 k2 1 k2 5 V 4 V 0.5 k

Explain briefly what is meant by electronic data interchange (EDI). How does EDI affect a companys audit trail?

Modify the TelephoneNumber class described in Exercise 6 so that it is serializable. Write a program that creates an array whose base type is TelephoneNumber by reading data from the keyboard. Write...

A palindrome is a word or phrase that reads the same forward and backward, ignoring blanks and considering uppercase and lowercase versions of the same letter to be equal. For example, the following...

Suppose that we would like to perform a bird survey to count the number of birds of each species in an area. Create a class BirdSurvey that is like one of the linkedlist classes given in this...

Why do you think that the traits of successful Western and Eastern leaders appear to be so different? Or do you think that they are similar? What is it about the environment or culture that might...

In the context of the discussion of different types of change in Chapter 2, and the idea that organizations must be alert to their everchanging environments, debate the advisability of seeking...

Think about great leaders, past and present, and list as many of them as you can. (This is great fun to do in a group, and forms the basis of a game called Who am I?.) Next, write down those...
Question Categories