Lesson 1

Importing code into Python


Alright, now that we’ve made sure everything is set up correctly, let’s start some coding!

Type the code into your Project1.py file as shown below.

On line 1 we have some green text, beginning with a “#“.

Lines of code that start with “#” are comments. These are ignored by the computer and are meant to make notes for the programmer to remember what he/she wrote.

Comments are used as notes for both yourself and other programmers to help remember/understand how code works. They are probably of the most useful programming tools, and one of the easiest!

On line 2 we have a keyword called import (keywords are important built-in words of a programming language, they usually have colors to help them stand out.).

“turtle” is a library, pre-existing code that we can pull and use in our own programs so that we do not have to write everything from scratch.

Since our program now knows what a turtle is, we will be able to control it with our code