-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathChristmasTree.py
50 lines (49 loc) · 1.11 KB
/
ChristmasTree.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
import turtle
screen = turtle.Screen()
screen.setup(800,600)
circle = turtle.Turtle()
circle.shape('circle')
circle.color('#D2042D')
circle.speed('fastest')
circle.up()
square = turtle.Turtle()
square.shape('square')
square.color('#006400')
square.speed('fastest')
square.up()
circle.goto(0,280)
circle.stamp()
r = 0
for i in range(1, 17):
q = 30*i
for j in range(i-r):
p = 30*j
square.goto(p,-q+280)
square.stamp()
square.goto(-p,-q+280)
square.stamp()
if i % 4 == 0:
p = 30*(j+1)
circle.color('#F01F41')
circle.goto(-p,-q+280)
circle.stamp()
circle.goto(p,-q+280)
circle.stamp()
r += 2
if i % 4 == 3:
p = 30*(j+1)
circle.color('#FBFA59')
circle.goto(-p,-q+280)
circle.stamp()
circle.goto(p,-q+280)
circle.stamp()
square.color('#9C661F')
for i in range(17,20):
q = 30*i
for j in range(3):
p = 30*j
square.goto(p,-q+280)
square.stamp()
square.goto(-p,-q+280)
square.stamp()
turtle.exitonclick()