CompositionΒΆ

radius = distance(xc, yc, xp, yp)
result = area(radius)
return result

Wrapping that up in a function, we get:




(ch06_newarea)

Note that we could have written the composition without storing the intermediate results.

def area2(xc, yc, xp, yp):
    return area(distance(xc, yc, xp, yp))
Next Section - Exercises