Challenge 2: Draw a donut

Suggested time: 15 minutes

A student is writing a program to draw a donut with pink frosting and chocolate sprinkles. The program uses turtle graphics to generate a picture like the one below:

Example output from the working code

Using the file below:

Amend the code to add or complete lines to

  • import another module needed by the code on original line 7
  • create an constant called SPRINKLE_COUNT and set it to the integer value fifty on original line 18
  • draw a circle with a radius of 80 at x = 0, y = 20 on original line 49
    draw_circle( , , FROSTING_COLOUR, )
  • make the next block of code repeat SPRINKLE_COUNT times on original line 52
    for i in (SPRINKLE_COUNT):
  • draw one circle over the top of the donut to be the hole in the middle on original line 59
    (0, 70, BACKGROUND_COLOUR, 30)

Do not add any additional functionality

If this was a real question it would tell you to save your code as but you might want to save your code so you can show your teacher or come back to it later by pressing Ctrl + S or clicking on the icon that looks like this:

Save / share icon in lets you save your code