0

```
Program to make snowflake!
# Local graphics module. Must be in same folder as this
# program (or both on Desktop)
import ecs10graphics as gr
# Math module that comes with Python
import math
def pointOnCircle(f, r):
# f is fraction of the way around
# r is radius
# produces a point f way around circle c,r
# Use the global variable "center".
c = center
a = (2*math.pi)*f + math.pi/2.0
x = c[0] + math.cos(a)*r
y = c[1] + math.sin(a)*r
return [x,y]
def circleSegment(f1, f2, r1, r2):
# f1 is first fraction, r1 first radius
# f2 is second fraction, r2 second radius
# draws a segment from point f1, r1 to point f2, r2
p1 = pointOnCircle(f1, r1)
p2 = pointOnCircle(f2, r2)
gr.line(p1[0], p1[1], p2[0], p2[1], lineWidth=5)
# Start graphics window
gr.begin_graphics(500, 500, title="Snow Flakes",
background = gr.Color.dark_blue)
gr.set_Color(gr.Color.white)
center = [250,250]
for i in range(6):
frac = i/6.0
circleSegment(frac, frac, 0, 250)
# A line
circleSegment(frac+.05, frac+.05, 100, 200)
# It's mirror image
circleSegment(frac-.05, frac-.05, 100, 200)
# A line
circleSegment(frac+.05, frac, 200, 220)
# Its mirror image
circleSegment(frac-.05, frac, 200, 220)
# A line
circleSegment(frac+.05, frac+(1.0/12), 100, 100)
# Its mirror image
circleSegment(frac-.05, frac-(1.0/12), 100, 100)
# Display loop.
# Display the window, and wait for it to be closed
alive = True
while alive:
alive = gr.sleep(.05)
gr.end_graphics()
# Put new drawing code here, followed by another display loop.
# Start graphics window
raw_input("Press enter to exit:")
```

i was able to make a snowflake for my assignment but now im confused what to do now i need to make a function instead of writing out the program

here's the instructions:

Add a function drawBothLines() that draws a line and its mirror image. And change the program so that instead of calling circleSegment() six times in the block under the for loop, it calls drawBothLines() three times.

So drawBothLines() should draw two line segments instead of one, and it will need to figure out two points for each segment, for a total of four points. So it will have four calls to pointOnCircle(), and two calls to gr.line().

can i get some help please