Question: Create the following function and call it from your main: def mathPractice ( ) : Write a function that will help a young student practice

Create the following function and call it from your main:
def mathPractice():
Write a function that will help a young student practice their math skills.
Print a 'welcome' message.
Within a' loop, do the following:
Select two random integers from 1 to 100. Ask the user to enter the sum of these two nurrijers. For example, if the two random numbers selected were 14 and 21, your prompt should look as follows:
What is 14+21?
Display whether or not they were correct. If incorrect, display the correct answer.
At any time, if the user enters 'quit', the loop should stop.
After the loop, display the total number of questions the user got right and wrong.
You may assume that the input is valid (either a numeric answer or 'quit')
Example:
Welcome to math practice.
What is 7+81?
User enters: 88
That's correct.
What is 2+6?
User enters: 9
Sorry, the correct answer is 8.
What is 56+99?
User enters: 33
Sorry, the correct answer is 155.
What is 23+67?
User enters: quit
Number of questions correct: 1
Number of questions incorrect: 2
Thanks for playing
 Create the following function and call it from your main: def

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!