Assignment#3: Turtle Graphics

In this lesson, the concepts of turtle graphics were taught to us. To show my understanding, I had to use turtle graphics to create 100 lines with a random length.

On line 1, the module “turtle” was imported in order to use the definitions(key words) for turtle graphics.

On line 2, the “random” module was imported to be able to created the random sized lines

Line 3 gives the turtle a name.

The code on line 4 makes the background color red.

On line 5, the code makes the color of the turtle’s trail blue.

The coding on line 6 simply programs to turtle to make 100 lines.

Line 6 tells the turtle to rotate to right any amount which is between 0 and 45 degrees.

Line 7 the variable “dist_Move was created to create lines at a random length between 0 and 150 forward(seen on line 8) and backward(seen on line 9).

turtle-graphics