Fun with Shapes 3 points 4 points 5 points


In you will be drawing a shape using a loop, just like you did with the square in the Warmup. Use a for loop with the picture.draw_forward() and picture.rotate() commands to draw a polygon that has 6 or more sides, where all sides are of equal length. (So you might draw a hexagon, a heptagon, an octagon, or something with even more sides.)


All of the turns the pen makes while drawing a shape will add up to 360 degrees, since it turns completely around while drawing it.

Your shape should look something like this:

Feel free to get creative with both the shape color and background color!

Reminder: commit and push your code!


For every picture drawn in this lab, picture.save_picture(filename.png) should be the last line of the file to make sure all of your code is implemented in the picture. Substitute filename for whatever you want the file to be called.


In the previous problem, you likely used a single for loop to draw your shape. Now, in we’ll put that for loop inside another for loop to draw multiple shapes, rotated around a single point. To earn full credit on this task, you need to pick a shape with n sides, drawn in a color of your choice, which will be rotated and drawn m times.

As an example, here is a picture made by drawing a hexagon (n = 6) m = 8 times, rotating between each time:

Just like before, you need to rotate in a complete circle, which means that to get the amount to rotate between each shape, you should divide 360 by the number of shapes you’re drawing (m).

Reminder: commit and push your code!

Fancy Spiral

The picture below was made by changing both the length of the sides of the shape and the color of the shape each time it was rotated. For this exercise, you will make a program named, which contains another fancy rotated shape.

To earn full credit for this task, your code needs to contain a shape, rotated and repeated multiple times, with some aspect of the shape changing every time it’s rotated (e.g., side length, color).

If you’d like to change the color of the shape in your loop, you will need to play around with passing RGB (red, green, blue) values to the picture.set_outline_color() command. For example, the code that changes the colors in the drawing above looks like this:

red = 50
green = 255
blue = 0

for i in range(8):
  picture.set_outline_color((red, green, blue))
  # add code to draw the hexagon in a for loop
  # use the picture.rotate() command to change where the next shape draws

  # increment/decrement the color values
  # we can use mod to ensure that each color value stays between 0 and 255 
  green = (green - 20) % 255
  blue = (blue + 20) % 255

Get creative with what you do here!

Reminder: commit and push your code when you’re finished!