Answered step by step
Verified Expert Solution
Link Copied!

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:

  1. The parameter user_solution that is assigned the user's answer to the mathematical expression generated by the quiz.
  2. The parameter solution that is assigned the actual solution to the mathematical expression generated by the quiz.
  3. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

Students also viewed these Databases questions