I have been using python in my tech class. We have been programming concepts using the FOR Loop. We have been doing a code for a maze game so that Tina can go through the maze.
The For' loop has become our friend and we are discovering that instead of writing the same code over and over again we can use 'smart' code or efficient code.
#Turtle Maze Challenge - www.101computing.net/turtle-maze/
import turtle
import maze
myPen=turtle.Turtle()
myPen.penup()
myPen.goto(20,-180)
myPen.pendown()
myPen.shape('turtle')
myPen.color("#DB148E")
myPen.width(5)
myPen.left(90)
#Start of maze
for i in range(0,3):
myPen.forward(70)
myPen.right(90)
myPen.forward(120)
myPen.left(90)
myPen.forward(45)
myPen.left(90)
myPen.forward(120)
myPen.right(90)
Here is what the challenge looks like
No comments:
Post a Comment