-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstar_pattern.py
More file actions
41 lines (35 loc) · 1.13 KB
/
star_pattern.py
File metadata and controls
41 lines (35 loc) · 1.13 KB
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
################################################################################
# Description: Programs to draw a star created given by specific # of points by user
################################################################################
# Don't change this
from turtle import *
def main():
# Don't change this block --------------------------------------------------
setup(564, 564)
width(7)
side_length = 60 # Also the radius of a circle enclosed by the star.
penup()
goto(0, -side_length) # Start at the bottom of the star.
pendown()
# --------------------------------------------------------------------------
# Write your code here
#screen = Screen()
num_point = int(input("Enter how many side points: "))
#num_point = 8
A = 360 / num_point
B = 2 * A
fillcolor('yellow')
begin_fill()
#inner_angle = star_angle * 2
right((180 - B) / 2)
speed(0)
for i in range(num_point):
forward(side_length)
left(180 - A)
forward(side_length)
right(180 - B)
end_fill()
# Don't change this
if __name__ == '__main__':
main()
done()