Answered You can hire a professional tutor to get the answer.

QUESTION

Python The software allows the student to select the arithmetic operation she or he wishes to study. The student chooses from a menu one of two...

Python

The software allows the student to select the arithmetic operation she or he wishes to study. The student chooses from a menu one of two arithmetic operations: Addition and Multiplication. Then the student is asked how many questions would he/she like to be tested on. That number is stored in variable called n. Based on the student's choice and answer, the software tests the student with exactly n questions. If n is zero no test should be performed). For each of the n questions, two random positive one-digit integers are generated; then the student is asked to enter the answer for the arithmetic operation applied to the two numbers.

At the end, the software displays a message "Well done! Congratulations." if at least 80% of the questions are answered correctly; if at least 60% but less than 80% of the questions is answered correctly, the program should display"Not too bad but please study and practice some more.", otherwise, the program should display "Please study more and ask your teacher for help.".

a) Implement a Python function, called, perform_test, that will execute all the arithmetic tests for a student for multiplication or addition operations. The function has two input parameters; the first one is an integer, 0 or 1, that represents the required operation (1 for multiplication and 0 for addition), the second one is a positive integer n representing the number of questions in the test. Then it gets the student to answer n questions as follows:1. 2. 3.Randomly generates two positive one-digit integers.Ask the student to enter the answer for the arithmetic operation of the two numbers.Checks if the result is correct. If the answer is incorrect, it provides the correct answer.

As questions are answered, the correct answers are counted. The number of correct answers is returned by the function.

b) (Outside of the function) implement the main part of the program to interact with the student to obtain the choice for either multiplication or addition and the number of questions, then call the function developed in part (a) to test the student (recall that the function returns the number of correct answers). Then print one of three possible messages to the student ("Well done! Congratulations." or "Not too bad but please study and practice some more." or "Please study more and ask your teacher for help.", as determined by the criteria listed above).

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question