Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE ANSWER IN PYTHON Write a function named midline that draws a line based o

ID: 3574464 • Letter: P

Question

PLEASE ANSWER IN PYTHON

Write a function named midline that draws a line based on two passed parameters t, a turtle to use to draw length, the length of the line to draw The turtle t is initially at the midpoint of the line that midline draws When midline returns t should be in its initial position and orientation Do not make any assumptions about the initial position or orientation of t. Write a function named starburst that uses turtle graphics to draw a number of lines of increasing length that share a common midpoint Each line is offset from the previous line by a specified angle The function starburst must repeatedly call the function midline The function starburst takes 5 parameters: t, a turtle used for drawing num, the number of lines to draw init, the length of the first line delta, the multiple by which successive lines increase in length angle, the counter clockwise rotation between successive lines For example if starburst is called by the following code, the drawing below would be correct output. import turtle s = turtle. Screen() t = turtle.Turtle() t. Left(45) starburst (t, 7, 50, 1.2, 20)

Explanation / Answer

import turtle

def midline(t, length):
   t.forward(length/2)
   t.backward(length)
   t.forward(length/2)
  
def starburst(t, num, init, delta, angle):
   current_len = init
   for i in range(num):
       midline(t, current_len)
       t.left(angle)
       current_len = current_len * delta

s = turtle.Screen()

t = turtle.Turtle()

t.left(45)

starburst(t, 7, 50, 1.2, 20)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote