QUESTION IMAGE
Question
4.6.1 functions and exceptions quiz
question: 1
which of the following options is not a valid python function definition?
computes the surface area of a cube of side length 10
#
def surface_area():
return 2*(100 + 100 + 100)
computes the surface area of a rectangular prism
def surface_area(length, width=10, height):
return 2(length width + width height + height length)
computes the surface area of a rectangular prism
def surface_area(length, width, height):
return 2(length width + width height + height length)
computes the surface area of a rectangular prism
def surface_area(length, width, height=10):
return 2(length width + width height + height length)
In Python, when defining a function with default parameters, non - default parameters must come before default parameters. In the option "def surface_area(length, width = 10, height):", the non - default parameter height comes after the default parameter width. This violates Python's function definition rules.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
The second option (def surface_area(length, width = 10, height): return 2(length width + width height + height length)) is not a valid Python function definition.