Need a decomposition for the following code import turtle # this method will draw one frieze pattern, with count number of spokes, each of given length # and separated by the given angle def frieze(t, length, count, angle): # looping for count number of times for i in range(count): # moving forward the turtle length spaces t.forward(length) # moving back to reach original position t.backward(length) # turning right by the given angle degrees t.right(angle) # end of frieze method # creating a turtle object tur = turtle.Turtle() # using a slightly thicker pen tur.pensize(2) # maximum speed tur.speed(0) # pen up tur.penup() # moving to (-200,0) tur.goto(-200, 0) # pen down tur.pendown() # looping for 5 times for i in range(5): # drawing a pattern of spoke length 40, spoke count 8 and angle 45 degrees frieze(tur, 40, 8, 45) # pen up, moving forward 100 spaces, pen down tur.penup() tur.forward(100) tur.pendown() # finishing the drawing turtle.done()
Need a decomposition for the following code
import turtle
# this method will draw one frieze pattern, with count number of spokes, each of given length
# and separated by the given angle
def frieze(t, length, count, angle):
# looping for count number of times
for i in range(count):
# moving forward the turtle length spaces
t.forward(length)
# moving back to reach original position
t.backward(length)
# turning right by the given angle degrees
t.right(angle)
# end of frieze method
# creating a turtle object
tur = turtle.Turtle()
# using a slightly thicker pen tur.pensize(2)
# maximum speed tur.speed(0)
# pen up tur.penup()
# moving to (-200,0)
tur.goto(-200, 0)
# pen down tur.pendown()
# looping for 5 times
for i in range(5):
# drawing a pattern of spoke length 40, spoke count 8 and angle 45 degrees
frieze(tur, 40, 8, 45)
# pen up, moving forward 100 spaces, pen down
tur.penup()
tur.forward(100)
tur.pendown()
# finishing the drawing turtle.done()
#output
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images