Turtle Graphics

Turtle graphics

Create the following turtle graphic

The following lab should be uploaded on your ePortfolio when is finished.

Using the turtle and random modules from Python, write a program (or script) to create an output screen as the one shown in the figure below.

To achieve this output you have to do the following:

  • Change the color of the window to “red” using wn.bgcolorproperty of the screen variable you create.
  • Your turtle variable has to have a pen color “white”, you have to use the .pencolor property of your turtle variable.
  • You have to make your turtle to change its heading to the right with an random angle between 0 and 45 degrees.
  • Move your turtle forward a random distance between 0 and 150 pixels.
  • Then move the turtle backward the same distance than above
  • Repeat the last three steps 100 times

For this assignment, I had to use turtle graphic to create a flower. First, I had to import turtle and random modules. Then follow the instruction above and use the range function to repeat it 100 times.