Skip to content

Instantly share code, notes, and snippets.

@rubycarefree
Created August 9, 2022 15:10
Show Gist options
  • Save rubycarefree/2a92bb1261fdac5bd7f4df57ec7af7d5 to your computer and use it in GitHub Desktop.
Save rubycarefree/2a92bb1261fdac5bd7f4df57ec7af7d5 to your computer and use it in GitHub Desktop.
This function to calculate the area of a rectangle is not very readable. Can you refactor it, and then call the function to calculate the area with base of 5 and height of 6? Tip: a function that calculates the area of a rectangle should probably be called rectangle_area, and if it's receiving base and height, that's what the parameters should b…
def rectangle_area(base, height):
area = base * height
print("The area is " + str(area))
rectangle_area(5,6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment