generated from mwc/lab_names
Submitted on the area of a circle lab.
This commit is contained in:
33
shapes.py
33
shapes.py
@@ -2,10 +2,37 @@
|
|||||||
# ---------
|
# ---------
|
||||||
# By MWC contributors
|
# By MWC contributors
|
||||||
|
|
||||||
from turtle import *
|
from turtle import forward, right, left, penup, pendown, goto
|
||||||
|
|
||||||
def triangle(side_length):
|
def triangle(side_length):
|
||||||
pass
|
forward(side_length)
|
||||||
|
right(120)
|
||||||
|
forward(side_length)
|
||||||
|
right(120)
|
||||||
|
forward(side_length)
|
||||||
|
left(120)
|
||||||
|
|
||||||
def rectangle(height, width):
|
def rectangle(height, width):
|
||||||
pass
|
forward(width)
|
||||||
|
right(90)
|
||||||
|
forward(height)
|
||||||
|
right(90)
|
||||||
|
forward(width)
|
||||||
|
right(90)
|
||||||
|
forward(height)
|
||||||
|
right(90)
|
||||||
|
|
||||||
|
def flyto(x, y):
|
||||||
|
penup()
|
||||||
|
goto(x, y)
|
||||||
|
pendown
|
||||||
|
|
||||||
|
flyto(-100, 0)
|
||||||
|
rectangle(2, 4)
|
||||||
|
rectangle(4, 8)
|
||||||
|
rectangle(8, 16)
|
||||||
|
flyto(100,0)
|
||||||
|
triangle(10)
|
||||||
|
triangle(20)
|
||||||
|
triangle(30)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user