SO during the rest week our teacher gave us a small project requiring Spirograph, here is the code that he helped us write before
from graphics import *
from math import *
def ar(a):
return a*3.141592654/180
def main():
x0 = 100
y0 = 100
startangle = 60
stepangle = 120
radius = 50
win = GraphWin()
p1 = Point(x0 + radius * cos(ar(startangle)), y0 + radius * sin(ar(startangle)))
for i in range(stepangle+startangle,360+stepangle+startangle,stepangle):
p2 = Point(x0 + radius * cos(ar(i)), y0 + radius * sin(ar(i)))
Line(p1,p2).draw(win)
p1 = p2
input("<ENTER> to quit...")
win.close()
main()
he then wants us to develop a program that sequentially draws 12 equilateral triangles (each time turning the triangle 30 degrees through a full circle 360). This can be achieved by "step" the STARTANGLE parameter. My question is: I was fixated on where to go from here, what does he mean by βstepβ? I suppose to do some kind of cycle, is it possible that someone can give me a push on the right step?
source
share