Separate local adjustment from caller state

A force sensor correction subtracts a supplied zero offset plus an additional 2.0 N calibration adjustment. Consider this Python 3 code:


Python
def corrected_force(raw_force_n, zero_offset_n):
    zero_offset_n = zero_offset_n + 2.0
    return raw_force_n - zero_offset_n

offset_n = 5.0
first_n = corrected_force(105.0, offset_n)
second_n = corrected_force(first_n, offset_n)


After both calls finish, what are the values of first_n, second_n, and offset_n, respectively? All three values are in newtons.

Choose an answer

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 User-Defined Functions Questions: