Untitled

mail@pastecode.io avatar
unknown
plain_text
25 days ago
703 B
0
Indexable
Never
#This function will draw the squares
def draw_square(dimension, label): 
    half_dimension = dimension / 2
    penup()
    goto(-half_dimension, 0)
    pendown()
    for i in range(4): 
        forward(dimension)
        left(90)
        
#Variable list
dimensions = [25, 50, 75, 100]   

#Drawing squares on canvas
speed(0)
for i in range(len(dimensions)): 
    draw_square(dimensions[i], i + 1)
    penup() 
    goto(0,0)
    pendown()

#number label
penup()    
goto(0, 10)
write("1", font=("Arial", 16), align="center")
goto(0, 32)
write("2", font=("Arial", 16), align="center")
goto(-1, 56)
write("3", font=("Arial", 16), align="center")
goto(-1, 81)
write("4", font=("Arial", 16), align="center")
Leave a Comment