-
Notifications
You must be signed in to change notification settings - Fork 0
/
Turtle.Py
56 lines (46 loc) · 1.08 KB
/
Turtle.Py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#import turtle funtion from library
from turtle import Turtle
#assign the turtle object to a variable
jude = Turtle()
#turtle is placed on a coordinate plane. It starts at (0,0)
#move the turtle with the functions that it already knows (number of pixels)
jude.forward(100)
jude.left(90)
jude.forward(100)
jude.right(10)
jude.forward(150)
#create a tutle and draw a square
from turtle import Turtle
laura = Turtle()
laura.forward(50)
laura.left(90)
laura.forward(50)
laura.left(90)
laura.forward(50)
laura.left(90)
laura.forward(50)
#create triangle with three different colored sides. Color name is a string
from turtle import Turtle
laura = Turtle()
laura.color("pink")
laura.forward(100)
laura.left(120)
laura.color("green")
laura.forward(100)
laura.left(120)
laura.color("blue")
laura.forward(100)
#pen control
from turtle import Turtle
laura = Turtle()
laura.forward(50)
# Move 50 pixels forward with the pen up
laura.penup()
laura.forward(50)
# Move 50 pixels forward with the pen down
laura.pendown()
laura.forward(50)
laura.penup()
laura.forward(50)
laura.pendown()
laura.forward(50)