Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from turtle import *
- def rectangle_area(height,length):
- area =int(height)* int(length)
- return area
- def draw_rectangle(length,height):
- hideturtle()
- begin_fill()
- color("green")
- forward (length)
- right (90)
- forward (height)
- right (90)
- forward (length)
- right (90)
- forward (height)
- right (90)
- end_fill()
- penup()
- color("blue")
- goto((length/2),(-height/2))
- pendown()
- write("Area: " + str(rectangle_area(height,length)), align="center")
- draw_rectangle(100,200)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement