Question: Question 2 Write a Python program, in a file called math_practice.py, for elementary school students to practice math problems with the floor division (//) and

Question 2 Write a Python program, in a file called math_practice.py, for elementary school students to practice math problems with the floor division (//) and modulus (%) operators using numerators of 1 or 2 digit numbers (denominators are always single digits from 1 to 9). Your program should include the following functions: function main that presents a set of math problems for practice as long as the student wishes to practice. For each set of problems. the main function o obtains, as input the number of problems required for the practice set the number of digits (1 or 2) for the numerator in this set of practice problems o processes each math problem by using the function displayProblem to display the problem and check the students answer for that problem; the displayProblem function returns True if the student got the answer right and False if they got it wrong o keeps track of number of correct answers o outputs the percentage of correct answers for the current set of problems before asking the student if they wish to practice with another set of problems function displayProblem which takes the number of digits required in the numerator and o randomly generates a numerator with the given number of digits (1 or 2) a denominator between 1 and 9, inclusive a number between 1 and 2, inclusive, representing one of the two operators (1 = floor division and 2 = modulus) o displays the problem using the randomly generated operands and operator o computes the correct answer o asks the student for their answer to the problem, tells the student if they have the answer correct or incorrect, and gives the correct answer if the student answers incorrectly o returns True if the students answer to the given problem is correct, False otherwise

sample input/output is as follows.

How many problems do you wish to do for this set? 5 How many digits in the numerators 1 or 2? 2

Enter your answer for the following problem: 98//6 = 1 Incorrect. Correct answer is 16.

Enter your answer for the following problem: 58//2 = 29 Correct!

Enter your answer for the following problem: 87%2 = 1 Correct!

Enter your answer for the following problem: 89//2 = 44 Correct!

Enter your answer for the following problem: 78//2 = 12 Incorrect. Correct answer is 39. The percentage of problems solved correctly is 60.00%. Do you wish to start another math practice session?

Enter 'Y' for yes or 'N' for No: Y How many problems do you wish to do for this set? 4 How many digits in the numerators 1 or 2? 1

Enter your answer for the following problem: 9%6 = 3 Correct!

Enter your answer for the following problem: 0%1 = 4 Incorrect. Correct answer is 0.

Enter your answer for the following problem: 2%5 = 2 Correct!

Enter your answer for the following problem: 5//5 = 1 Correct! The percentage of problems solved correctly is 75.00%. Do you wish to start another math practice session?

Enter 'Y' for yes or 'N' for No: N Good Bye

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!