Lab 2: Turtle Blast

Lab report 2 Turtle Blast

Lab Description:

In this lab we are working with a code called turtle. With a turtle you can make a shape or lines formed in a circle etc. In our lab we used a turtle to create a 100 lines that form a shape of a circle. we found out how to set a background color to the program and change the color of the line in the program. we said the way for it to move to have 100 lines that go around in a circle were they do not copy over one another.

Code:

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

 

Screen Shot:

kevin python 2 picture

kevin python 2 picture

Leave a Reply

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