Lab 2: Turtle Blast

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ā€)

Markell = turtle.Turtle()
Markell.pencolor(ā€œgreenā€)

x = random.randint(0,46)
y = random.randint(0,151)

for i in range(1,101):
markell.right(x)
markell.forward(y)
markell.backward(y)

Ā Screen shot:

jason101013

Leave a Reply

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