Recognize a keyword-only interface

An engineer writes this Python function to calculate pressure from force in newtons and area in square metres:


Python
def pressure(force_N, *, area_m2):
    return force_N / area_m2


Complete the statements about how its interface controls the following calls. Use the standard Python terminology and exact exception name.


In pressure(240.0, area_m2=0.006), the value for area_m2 is supplied as a . In contrast, pressure(240.0, 0.006) raises before the function body executes.

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: