[Tutor] calculating and using area of rectangle
Mark Lawrence
breamoreboy at gmail.com
Tue Sep 8 04:36:59 EDT 2020
On 08/09/2020 06:02, Korean Panda wrote:
> Attached is a screenshot of the exercise. So I'm needing help with with
> this. I'm getting the code to print the area, but for the purpose of
> cleaning up the code style, these commands are still incorrect. Any ideas?
>
> The code I tried is:
>
> def rectangle_area(base, height):
> area = base*height # the area is base*height
> print("The area is " + str(area))
>
> rectangle_area(4, 3)
>
> Here is your output:
> The area is 12
>
Please use a sensible title so the thread is easily found in the
archives if needed. Your screenshot will get stripped off by this text
only email list. However your rectangle_area only prints output,
methinks you'd want to 'return area' and use that outside of the
function call.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Tutor
mailing list