Import Turtle

 

The turtle is a function that allows the programmer to create a simple graphic image using codes. The first step is to start your function is with import turtle. After this name the turtle and set the name equal to turtle.Turtle() .  Then we set up a canvas for the turtle by setting a variable, wn, to equal to turtle.screen(). To have a color screen as your canvas use wn.bgcolor which takes the argument of the color red which must be in quotes.

 

snip20161211_5

 

 

 

 

 

 

 

 

 

Now we begin to give the turtle the features. First let’s make the turtle kyle blue, so we use kyle.color which takes an argument of a color blue in quotes. Now we change the color of the  kyle‘s pen color, so we use kyle.pencolor with an argument of white in quotations. Kyle will also take an argument of it’s shape by using kyle.shape with an argument of turtle in quotations, the shape of klye would be a turtle.

snip20161211_5

 

 

 

 

 

 

 

Let’s move the turtle in the canvas. We can face the turtle right or left by using kyle.right or kyle.left with the argument of a number that represents the angle of the turn. After this we can move the turtle forwards or backwards by using kyle.forward or kyle.backward with an argument of a number which will indicate how far will kyle go. We can repeat this step to make kyle move on each command line or we can use a for loop to move kyle. The loop is used to repeat steps instead of just typing each step every time. In this scenario the for loop uses x as a number of times the steps is repeated which is in range of (0,101). This means steps will be repeated 100 times. After the command line and the colon, the steps to move the turtle is included, kyle,forward(75) and kyle.right(43) followed by a kyle.backward(75).

snip20161211_5

 

 

 

 

 

 

 

 

The result:

snip20161211_4