Part A: 10 points Write a function named parallelLines(). The function parallelL
ID: 3589193 • Letter: P
Question
Part A: 10 points
Write a function named parallelLines(). The function parallelLines() takes four parameters:
1. a turtle 2. an integer, length, that is the length of each line 3. an integer, reps, that is the number of lines to draw 4. an integer, separation, that is the distance between parallel lines
For example, if length = 100, reps = 4 and separation = 10, the following is correct output
Part B: 10 points
Write code that calls parallelLines(),using the parameters in the example in part A. (Hint: before calline the function, you must import the turtle library and create a turtle.)
Explanation / Answer
import turtle STAMP_SIZE = 20 def parallelLines(my_turtle, length, reps, separation): separation += 1 # consider how separation 1 & 0 differ my_stamp = my_turtle.clone() my_stamp.shape('square') my_stamp.shapesize(1 / STAMP_SIZE, length / STAMP_SIZE, 0) my_stamp.tilt(-90) my_stamp.penup() my_stamp.left(90) my_stamp.backward((reps - 1) * separation / 2) for _ in range(reps): my_stamp.stamp() my_stamp.forward(separation) my_stamp.hideturtle() turtle.pencolor('navy') parallelLines(turtle.getturtle(), 250, 15, 25) turtle.hideturtle() turtle.exitonclick()