程序代写代做代考 Exercise 4-18 Hypnotic Pattern

Exercise 4-18 Hypnotic Pattern

import turtle

# Named constants
ANIMATION_SPEED = 0
NUM_LINES = 50
STARTING_LENGTH = 1
ENDING_LENGTH = 500
STEP = 10
ANGLE = 90

#Initialize the turtle.
turtle.hideturtle()
turtle.speed(ANIMATION_SPEED)

# Draw the lines.
for x in range(STARTING_LENGTH, ENDING_LENGTH, STEP):
turtle.forward(x)
turtle.left(ANGLE)

Start End forward(x) left(90) x = 1 to 500 step 10 Next Done