Modify the program from Lab 3 to show the shades of green and then move the turtle forward 300 steps without writing (use the penup() and pendown() turtle functions) and repeat the same loop, but backwards.
Your output should look similar to:
#import turtle module
import turtle
#set color mode
turtle.colormode(255)
#create a turtle object
tess=turtle.Turtle()
tess.shape("turtle")
tess.backward(100)
#using loop draw first half
for i in range(0,255,10):
tess.forward(10)
#pen size increases with i
tess.pensize(i)
#i represents blue color
tess.color(0,0,i)
#same as above loop but in reverse
for i in range(255,0,-10):
tess.forward(10)
#pen size increases with i
tess.pensize(i)
#i represents blue color
tess.color(0,0,i)
Comments
Leave a comment