Level 1: Challenge 1 - IncrediCoders/Python1 GitHub Wiki
Grafika Turtle added this page on March 14, 2025
Let's begin your first challenge for Level 1!
You are going to map a different route to the school, which will cross the bridge over the lake.
To find the Level 1 Challenge 1 code template, open the Level 1 folder, the Challenges folder, and then the Challenge 1 folder. You should already have the files downloaded onto your computer (see Load the IncrediCoders Files). Open the TurtleMapChallenge1.py file in Visual Studio Code to build the program by following along with my instructions below!
I broke these instructions down into a few sections:
On Line 2, the code imports the init.py file (which grabs the files from your folder):
from init import *
On Line 3, import turtle
brings in the turtle
module, which includes a lot of code you can use (called methods). For example, you can tell the turtle which direction to go in (and how far to go), you can set the color and shape of the turtle, etc. I already told you about methods in the book. Let me explain what a module is...
A module is a Python file that holds useful code in it, just like how a toolbox is full of useful tools. A module has a specific purpose, like complex math functions, or allowing you to control a turtle. For example, in
turtle.forward(125)
, the module isturtle
.
On Line 6, SCREEN = turtle.Screen()
creates a new window for your turtle program.
On Line 7, SCREEN.title("Mapster Spacebook")
sets the title name ("Mapster Spacebook") for the window that we created in the last line of code.
(ED TO DO: to add an image of what the window title ("Mapster Spacebook") looks like.)
On Line 8, SCREEN.setup(1280, 800)
sets the size of the window that we made in the code from Line 6, so that it is 1280 pixels wide and 800 pixels tall.
On Line 9, SCREEN.bgpic(get_file("Assets/Background.gif"))
sets up our background image on the window. This image shows the map of the roads that you'll use, to move the turtle from my house to the school.
To review, here are Lines 6-9, which set up the window, set the title of the window, set the size of the window, and put the background image in the window:
SCREEN = turtle.Screen()
SCREEN.title("Mapster Spacebook")
SCREEN.setup(1280, 800)
SCREEN.bgpic(get_file("Assets/Background.gif"))
On Line 6, where it says turtle.Screen()
, turtle
is the module and .Screen()
is the method.
A module (like
turtle
), Python file, or class can hold methods, which are lines of code that we can reuse to tell our program what to do. For example, on Line 12, in the codeturtle.shape("turtle")
,.shape()
is the method we are calling from theturtle
module.
On Line 12, turtle.shape("turtle")
creates a new turtle shape on the screen, by using the code from the imported turtle class. That turtle shape is going to represent Monty Python's car, showing the path that he needs to drive, in order to get to the IncrediCoders Academy.
(If we didn't set the turtle.shape()
parameter to "turtle"
, then the car would appear as an arrow instead. We could have set the shape as a car, which might make more sense, but because we're teaching turtle graphics, and I'm a turtle, we set the shape as a turtle instead!)
A value that is passed into your method. For example, when we run
turtle.shape("turtle")
, we send the"turtle"
parameter to the shape method. This is what tells theturtle
object/module to change the appearance of the turtle.
On Line 13, turtle.color("green")
changes the color of the turtle (that we created in the code from Line 12) to green, by using the .color()
method from the imported turtle
module.
On Line 16, turtle.penup()
lifts the pen off the window so that while it is moved to its starting position, it does not draw any lines on the window.
The way that these lines of codes are being written is called the syntax. Let me go into more detail about what syntax is...
Syntax is a set and order of words in code, to give the computer instructions it understands. If you break the rules of the syntax, then your code shows you errors. For example, if we wrote "turtle.PENup(up);" instead of
turtle.penup()
, then Python would produce errors, to let us know to use the right casing (lowercase), to not write anything in the parentheses, and to not use punctuation (the semicolon) at the end of the line of code.
On Line 17, turtle.setx(460)
sets the x position of the turtle character (that you created in the code, back on Line 12). The turtle is placed at the x location of 460 pixels. Let me describe what a pixel is so you can understand more about what moving the turtle does:
A pixel, also known as a picture element, is the smallest controllable element of a picture on a screen. When we say an image is the resolution of 460 by 500, we are counting the width and length of the image in pixels. So,
turtle.setx(460)
, sets the turtle 460 of these pixels to the right of the turtle's starting x position (which is 0).
On Line 18, turtle.sety(-275)
sets the y position of the turtle to -275 pixels. That means that the turtle is lowered 275 pixels on your screen (from the 0 y position), before we set it down.
On Line 19, turtle.pendown()
puts the pen back down on the window, so that when the turtle is moved, it will create a line from its current location to its next location.
To review, here are Lines 12-13, which set the turtle shape and color:
turtle.shape("turtle")
turtle.color("green")
And here are Lines 16-19, which move the turtle sprite into its starting position:
turtle.penup()
turtle.setx(460)
turtle.sety(-275)
turtle.pendown()
Let me go into more detail about what a sprite is:
Your turtle character is a sprite. A sprite is a stand-alone on-screen object in a computer game. It can be manipulated in different ways. One way is by changing the sprite's location (its x and y position), like you did on Lines 17 and 18:
turtle.setx(460)
andturtle.sety(-275)
. However, there are other ways to make changes to a sprite, such as changing its color or adding other animation to it.
On Line 21, #TODO: Uncomment these lines by removing the hashtags
explains how to uncomment a line... you remove the hashtag in front of the code. By removing the hashtag, you include that line of code to be read when the program runs. When a line of code is commented out (a hashtag is in the front of the line), the program will not read that line of code. Let me go into more detail about what a comment is:
A comment is a note that you put in your code. If you add a hashtag symbol (#), then anything you write after that (on the line of code) becomes a comment. You can have a whole line act as a comment, or you can put a comment at the end of a line of code, to explain what that code does. In our template file, we also use comments to describe what code you should write in the line below it. A comment will not run with the program, but it will help you organize your code. Or it will help someone else, who did not work with you on the program, understand what your program does.
On Line 22, remove the hashtag to uncomment the code, turtle.left(180)
. When the program runs, this line of code will now rotate the turtle character 180 degrees to the left from its current position. The turtle is now facing left.
On Line 23, uncomment the code, turtle.forward(125)
. When the program runs, this line of code will move the turtle character forward 125 pixels. Since the turtle is facing left, this will change the current x position. The x direction on a graph is the direction that goes from left to right (horizontal). Here is the image again that I sent to you in my text message:

As you can see in the above image, the x coordinate determines where your turtle is from the left to right axis. If the x coordinate is a positive number, then the turtle is to the right of the middle of the window. If it is a negative number, the turtle is on the left side. Likewise, if y is set to a positive number, the turtle is higher on the screen, and if y is set to a negative number, the turtle is lower.
The comment on Line 25 state, #TODO: Turn right 90 degrees and move forward 105 steps
. Next, you'll code two separate movements, with one line of code for each movement.
The first movement tells the turtle to Turn right 90 degrees. To tell the turtle to make this turn, write turtle.right(90)
on Line 26.
The second command that you'll give the turtle is to Move forward 105 steps. To have the turtle move forward, write turtle.forward(105)
on Line 27.
Leave Line 28 blank with no code.
The comment on Line 29 states #TODO: Turn right 90 degrees and move forward 185 steps
. This time, you'll write two lines of code.
On Line 30, *use the
turtle.right() method to have the turtle turn 90 degrees to the right*
, and then on Line 31, **use the
turtle.forward() method to move forward 185 units**
. Python's Turtle method moves the turtle in units that are most commonly called the "Distance." It can also be close to measuring movements in pixels. We use the term "units" as that is likely the most accurate.
Here's how Lines 30-31 should look:
turtle.left(90)
turtle.forward(185)
Leave Line 32 blank with no code.
On Line 33, you'll see the comment, #TODO: Turn left and move to the end of the road
. On Line 34, you're going to write the code that tells the turtle to turn left 90 degrees. On Line 35, your code will then move the turtle forward 385 units from its current position. You'll write each movement on a new line.
On Line 34, type in the turtle.left()
method. Check out how this line of code is written on Line 22. Instead of turning 180 degrees (like on Line 22),type in the argument 90
in the parentheses to turn 90 degrees instead.
On Line 35, type in the turtle.forward()
method. This line of code is similar Line 31. Instead of going forward 185 units, you're going to move the turtle forward 385 units. Type 385
in the parentheses.
Leave Line 36 blank with no code.
On Line 37, you'll find the comment, #TODO: Turn left and move to the intersection
. You're going to turn the turtle to its left 90 degrees (on Line 38) and then move it forward 65 units (on Line 39).
Write each movement on a new line:
- On Line 38, type in the method to turn the turtle to its left 90 degrees. This is the exact same code as Line 34.
- On Line 39, type in the method to move the turtle forward 65 units. This is the same as Line 35, but you'll put the number
65
in the parentheses instead, to move the turtle forward 65 units.
Leave Line 40 blank with no code.
On Line 41, you'll find the code comment,#TODO: Write more lines here to navigate the alternate route to school
. You're going to write some methods that will create an alternate route to the school, for Monty Python (who's driving), Paul Python, and myself (I'm Grafika). Did you think I was driving? I'm too young to drive!
On Line 42, you'll find the comment, #Cross the bridge and stay on the road!
You're going to direct the turtle to go over the bridge, and of course your goal is to stay on the road at all times.
On Line 43, you'll start this new route with the first movement for your turtle. A movement is turning a certain direction than going forward a certain number of pixels. You'll create a blank line in between each movement.
For the first movement, on Line 43, turn the turtle to the right 90 degrees. This is the exact same as the code on Line 30.
Then, on Line 44, move the turtle forward 105 units. This is the exact same as Line 31.
For the second movement, on Lines 46-47, turn the turtle to the left 90 degrees (on Line 46), and then move the turtle forward 435 units (Line 47).
For the third movement, on Lines 49-50, turn the turtle to the left 90 degrees (on Line 49), and then move it forward 105 units (on Line 50).
For the fourth movement, on Lines 52-53, turn the turtle to the right 90 degrees (Line 52), and then move it forward 195 units (Line 53).
For the fifth movement, on Lines 55-56, turn the turtle to the right 90 degrees (Line 55), and then move it forward 80 units (Line 56).
For the sixth movement, on Lines 58-59, turn the turtle to the left 90 degrees (Line 58), and then move it forward 170 units (Line 59).
Leave Line 60 blank, of course.
On Line 61, you'll find the comment, #This line stops the window from closing once we make it to the end
. When coding, you should leave comments like this to describe what the next line of code does.
On Line 62, the code turtle.done()
stops the window from closing once we make it to the end. That's exactly what the comment says!
You did it! You planned our alternate route to IncrediCoders Academy!
I included a solution file for Level 1, Challenge 1. This file has all the code filled in, so if you run into any issues with your code (for example, if it doesn't compile/run, or if something isn't working correctly in your program), then you can take a look at the final code file to see what you did differently:
IMPORTANT: Please don't cheat yourself! Finish the game first!
Next, you can take on Level 1, Challenge 2! Use loops to go back and forth between my house and the school, five times. My house is on the back of a giant turtle, but I'm pretty sure he'll stay put long enough for this to work! The reason for doing this is because Paul's father, Monty, has to keep going back because Paul keeps forgetting his school supplies... at my house, apparently!
In addition to this page, we also have Level 1 Help (for the main game, in the book), Online Articles, a Learning Quiz, an Unplugged Activity, and a Rewards article:
-
Level 1: Help - This page helps you complete the instructions in the book, in case you get stuck.
-
Level 1: Online Articles - I made you a list of different web pages I found, which will help you learn more about creating Turtle Graphics.
-
Level 1: Learning Quiz - I wrote some questions in case you want to quiz yourself about what you learned. Or you can teach others and quiz them!
-
Level 1: Unplugged Activity - I wrote this page with more details than what you saw in the book. In this game, you'll have one person act as the Turtle, and one person is the Programmer!
-
Level 1: Rewards - If you completed the Turtle Map project that we talked about in the car, then I set up this page to act as a reward. You can see some illustrations of me and learn more about who I am! You'll also find the Turtle Award digital download, to show off your accomplishment!
After you're completely done with Level 1 (did you do Challenge 2?), then it's time to move on to Level 2! While you read through Level 2 in your book, you can check out the resources from Mrs. Scratcher, as she teaches you how to build the Class Discussion program:
I hope you had fun making this Turtle Maps alternate route, to get to IncrediCoders Academy! I'll see you at the academy!
-- Grafika Turtle