Using Repl.It

To help Alex live in a beehive, he needs to learn how to create a honeycomb! We will use Python’s turtle library to draw a honeycomb for Alex.

Using Repl.it

Today you will be using Repl.it to learn how to code in Python. Here is an example interactive window that you will use today:

Before we start, let’s first understand how the window works. The main.py file contains code, or instructions for the computer to run. By pressing the run button, you tell the computer to perform the instructions in the code. Any results from running the code will be displayed on the bottom white screen, under the result tab. Today, our results will be an animation of a drawing being created.

Next, let’s explain further some of the code that has been provided to you in the main.py file.

Libraries and import statements

Look at the top of the code. You will see the following line:

import turtle

This statement allows us to import all of the drawing functionality provided by the turtle library. A library is a place where related functionality are grouped together for use in the Python language. For example, the turtle library introduces a helpful artistic turtle in the result window, which we can control using our code to draw images.

Comments

The gray line that starts with # is called a comment. These are notes in the code that helps to explain what is happening in plain English. As they are ignored by the computer, they are often used so that when other developers work on the same code, they will have an easier time reading and understanding what is going on.