Respuesta :
Answer:
Here is the refactored function:
def rectangle_area(base, height):
area = base * height
return area
print("The area is ", rectangle_area(5,6))
Step-by-step explanation:
The above program has a function rectangle_area that takes two variables base and height as parameters. The function then computes the area of rectangle by multiplying the values of base and height. The result of the multiplication is assigned to the variable area. Then the function returns the resultant area.
print("The area is ", rectangle_area(5,6)) statement calls rectangle_area() method by passing values of base and height i.e. 5 and 6 to compute the area. The output of this program is:
The area is 30
Note that the use of rectangle_area function name describes what the function does i.e. it computes the area of rectangle. By naming the parameters as base and height that clearly depicts that in order to compute rectangle are we need the base and height of rectangle. So this makes the code readable.
