Carry values through a nested path

A reading challenge calculates reward points with the following Python code. For books = 5 and returned_on_time = False, what is the final value of points? Answer in points, to the nearest whole point.


Python
points = 9
if books >= 3:
    points = points + 7
    if returned_on_time:
        points = points * 2
    else:
        points = points - 4
points = points + 3

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Nested Decisions Questions: