Lab 2 Turtle blast

Lab description: In this alb we had created drawing by using pythons and learning the commands so that we can know how to control Alex the turtle that we are instructed to do.

source code

import turtle
import random

wn = turtle.Screen()
wn.bgcolor(‘red’)
alex = turtle.Turtle()
alex.pencolor(‘white’)

for i in range(100):

angle = random.randint(0,45)
alex.right(angle)
distance1 = random.randiat(0,150)
alex.forward(distance1)
alex.back(distance1)

 

matthew turtlemax turtle py.bmp 1

Leave a Reply

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