Exam-style question
Try this first
Write a Python subroutine called `calculateArea` with an interface that accepts `width` and `height` as parameters. It should calculate and return the area of a rectangle. Then show a call that passes 8 and 5 to the subroutine, and state the value returned.
Model answer
What a good answer should say
- ```python def calculateArea(width, height): return width * height area = calculateArea(8, 5) ``` The value returned is 40.
Explanation
Why this works
The interface is the subroutine name together with its two parameters, `width` and `height`. The call passes 8 to `width` and 5 to `height`.
The subroutine multiplies these values and returns 40.
Common mistake
No common mistake is linked to this question yet.
