Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Complete the check_solution() function that takes the following 3 integer parameters: The parameter user_solution that is assigned the user's answer to the mathematical expression generated
Complete the check_solution() function that takes the following 3 integer parameters:
- The parameter user_solution that is assigned the user's answer to the mathematical expression generated by the quiz.
- The parameter solution that is assigned the actual solution to the mathematical expression generated by the quiz.
- The parameter correct_answer_count that is assigned the number of questions the user has currently answered correctly.
The check_solution() function needs to check whether the user_solution and the solution are the same. If they are, the function should print "Correct" and then increment correct_answer_count by 1. Otherwise, the function should print "Incorrect". Finally, the function should return the correct_answer_count. Some examples of the function being used are shown below.
For example:
Test | Result |
---|---|
count = 5 user_solution = 10 solution = 10 count = check_solution(user_solution, solution, count) print("The correct count is now", count) | Correct The correct count is now 6 |
count = 5 user_solution = 10 solution = 7 count = check_solution(user_solution, solution, count) print("The correct count is now", count) | Incorrect The correct count is now 5 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started