Question: This MUST be in Python 3. Thank you in advance!! The use of computers in education is referred to as computer-assisted instruction(CAI). You are going

This MUST be in Python 3. Thank you in advance!!

The use of computers in education is referred to as computer-assisted instruction(CAI). You are going to write a CAI application program which assesses a students arithmetic capability. The program will present the user with 10 math problems to be solved, one at a time. The program will give feedback following each solution entered, indicating if that is correct or incorrect. The program will also need to keep track of the number of correct answers.

Your program should define these functions:

getOp(max)

This function accepts one parameter,max, and is to return one random int value. This value is to

be between 0 and the value of max. Hint: use the Python random module as shown in Chap 2

getOperator()

This function accepts no parameters and is to return one character value, +, - or * . The value

to be returned should be determined randomly (Hint: use a value returned by rand() to decide

which value to return)

doIt(operand1 , operand2, operator)

This function is to perform the operation indicated by the parameter values, and return the result.

That is, if the operator is + the function returns the sum of operand1 and operand 2. If operator is

* then the function is to return the product of operand1 and operand2.

displayProblem( operand1, operand2 , operator)

This function displays the problem to the screen in the form:

OPERAND1 operator OPERAND2 =

I would suggest that you verify that each of your functions work properly before going on to the actual main program for this project. You can do this by writing simple throw away program statements to call your functions and print the result values.

Your program will:

Get two operands and an operator (call functions getOp and getOperator)

Display the problem (call function displayProblem)

Ask the user for a solution

Determine if the solution was correct(function doIt helps here)

If the solution was correct, print Correct , otherwise print Incorrect

This should be repeated for 10 problems. Prior to exiting, the program should print the number of problems which were correct.

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!