Turtle Blast

Lab description: The turtle blast is commanded through series of code. First, using importing turtle to start. The  bgcolor is red and the pen color is supposed to be in white. Then later on the angles are supposed to repeat 100 times, so the x in range would be 100. After that, I used the random.randint to set the angle change from 0 to 45. The angle distance is within 150.

Source Code: 

import turtle
import random
wn=turtle.Screen()
wn.bgcolor(“red”)
ivan=turtle.Turtle()
ivan.pencolor(“white”)
for x in range (100):
ivan.right(random.randint (0,45))
distance = random.randint (0,150)
ivan.forward(distance)
ivan.backward (distance)

lab 3

Leave a Reply