Lab 2: Turtle Blast

Lab Description:

In this lab we used Python functions a lot. We used functions like “range”, “random”. We also used the module turtle to create a figure. This lab was pretty interesting and I had a great deal of fun doing it. At first I was having a lot of trouble getting my program to run, due to problems with my Syntax (thanks to python letting me know what type of errors I was making). Then after I kept review each line of code I was able to debug my program and find what was wrong and correct it. What I got most from this lab was not to give up if your program isn’t doing what to intend for it to do, but every time you do a few lines of code run and review it to make sure what you are doing is correct.

Code: 

import turtle
import random
wn = turtle.Screen()
wn.bgcolor(“red”)

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

 Screenshot:

jason101013

 

Leave a Reply

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