Question: Complete the display_result() function that takes two integer parameters: The parameter total, indicating the total number of questions asked during the quiz. The parameter correct,
Complete the display_result() function that takes two integer parameters:
- The parameter total, indicating the total number of questions asked during the quiz.
- The parameter correct, indicating the number of questions the user has answered correctly.
The display_result() function should:
- Print out how many questions they have answered, and the number they have answered correctly.
- The percentage of questions they have answered correctly. Note that the answer should be rounded to the nearest 2 decimal places. Also note that this percentage should be set to 0% if the student has not answered any questions (i.e. they have immediately exited the quiz).
Some examples of the function being used are shown below.
For example:
| Test | Result |
|---|---|
display_result(5, 4) | You answered 5 questions with 4 correct. Your score is 80.0%. Thank you. |
display_result(0, 0) | You answered 0 questions with 0 correct. Your score is 0%. Thank you. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
