lab 2 Turtle Blast

This code makes a turtle move constantly in random places.

import turtle
import random

wn = turtle.Screen()
wn.bgcolor(‘red’)
alex = turtle.Turtle()
alex.pencolor(‘white’)
alex.speed(5)
angle = random.randint(0,45)

for i in range(100) :
angle = random.randint(0,45)
alex.right(angle)
distance1 = random.randint(0,150)
alex.forward(distance1)
alex.back(distance1)

Screen Shot 2013-10-17 at 7.56.16 AM

2 thoughts on “lab 2 Turtle Blast

  1. Albert Gonzalez Post author

    import turtle
    import random

    wn = turtle.Screen()
    wn.bgcolor(‘red’)
    alex = turtle.Turtle()
    alex.pencolor(‘white’)
    alex.speed(5)
    angle = random.randint(0,45)

    for i in range(100) :
    angle = random.randint(0,45)
    alex.right(angle)
    distance1 = random.randint(0,150)
    alex.forward(distance1)
    alex.back(distance1)

    Reply
  2. Albert Gonzalez Post author

    import turtle
    import random

    wn = turtle.Screen() # Set up the window and its attributes
    wn.bgcolor(“red”)

    tess = turtle.Turtle() # gives me the screen and color blue for blastoff
    tess.color(‘blue’)

    random.randint
    blastoff = random.randrange (1, 45)

    turtle.Forward()
    turtle.backward()

    for i in range (100)

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *