Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from turtle import *
- import random as m
- s=40
- n=10
- tipp=16
- #s = int(input("Sisestage tähtede suurus: "))
- #n = int(input("Sisestage tähtede arv:"))
- #tipp = int(input("Sisestage tähtede tippude arv (peab olema paarituarv): "))
- def calculateangle():
- a = 360/tipp/2
- return a
- print(calculateangle())
- def calculatepolygonangle():
- a = 180*(tipp-2)/tipp
- return a
- up()
- shape("turtle")
- def drawstar():
- down()
- color("green")
- begin_fill()
- for i in range(tipp):
- forward(s)
- right(calculatepolygonangle())
- #right(120)
- forward(s)
- #left(60)
- left(calculateangle())
- end_fill()
- up()
- home()
- for i in range(n):
- left(m.randint(0, 360))
- forward(m.randint(0, 400-s))
- drawstar()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement