-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
85 lines (73 loc) · 1.55 KB
/
main.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import turtle
from turtle import *
while True:
try:
print("enter int > 2")
n=int(input(">"))
if not n >2:
raise ValueError
break
except:
pass
speed(5)
for i in range(1, n+1):
if i == 1:
print(" "*int(n-2),end="")
print("*")
pencolor("yellow")
for _ in range(8):
forward(75)
left(144)
left(108)
penup()
back(0.258819045 * 60 )
left(60)
forward(60)
right(165)
pendown()
pencolor("green")
for _ in range(i):
forward(60)
right(150)
forward(60)
left(150)
left(105)
forward(i * 0.258819045*60*2)##sin 15 = 0.258819045
penup()
left(75)
forward(60)
left(180)
pendown()
elif n == i:
print(" "*int(n-2),end="")
print("'",end="")
print()
right(180)
forward(((n-1) * 0.258819045*60)-10)
pencolor("brown")
right(90)
forward(30)
left(90)
forward(20)
left(90)
forward(30)
else:
print(" " * ((n-i)-1), end="")
for a in range(i-1):
print("'" + '"', end="")
print("'", end="")
for _ in range(i):
forward(60)
right(150)
forward(60)
left(150)
left(105)
forward(i * 0.258819045*60*2)
if not n-1 == i:
penup()
left(75)
forward(60)
left(180)
pendown()
print()
done()