generated from mwc/lab_names
resubmitting it didn't work properly the 1st time
This commit is contained in:
98
square.py
Normal file
98
square.py
Normal file
@@ -0,0 +1,98 @@
|
||||
from turtle import *
|
||||
|
||||
def square(side_length):
|
||||
for _ in range(4):
|
||||
forward(side_length)
|
||||
right (45)
|
||||
|
||||
|
||||
color ('red')
|
||||
pensize (10)
|
||||
speed (9)
|
||||
|
||||
sizes = [20, 40, 60, 80, 100]
|
||||
for size in sizes:
|
||||
square(size)
|
||||
penup()
|
||||
right(90)
|
||||
forward(20)
|
||||
left(90)
|
||||
pendown()
|
||||
square(size)
|
||||
penup()
|
||||
right(90)
|
||||
forward(20)
|
||||
left(90)
|
||||
pendown()
|
||||
square(size)
|
||||
penup()
|
||||
right(90)
|
||||
forward(20)
|
||||
left(90)
|
||||
pendown()
|
||||
square(size)
|
||||
penup()
|
||||
right(90)
|
||||
forward(20)
|
||||
left(90)
|
||||
pendown()
|
||||
square(size)
|
||||
penup()
|
||||
right(90)
|
||||
forward(20)
|
||||
left(90)
|
||||
pendown()
|
||||
|
||||
from turtle import *
|
||||
|
||||
|
||||
def rectangle(width, height):
|
||||
|
||||
for _ in range(2):
|
||||
forward(width)
|
||||
right(90)
|
||||
forward(height)
|
||||
right(90)
|
||||
|
||||
|
||||
penup()
|
||||
color('green')
|
||||
pensize(10)
|
||||
speed(3)
|
||||
|
||||
|
||||
|
||||
left(90)
|
||||
pendown()
|
||||
rectangle(width = 100, height=100)
|
||||
penup()
|
||||
forward(90)
|
||||
pendown()
|
||||
rectangle(width=100, height=100)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user