Lab 2: Extra bagels
These extra exercises build on the bagels functions; if you haven't finished that part you should do that first.
Create a made-to-order custom bagel
Write a function called makeCustomBagel
which takes zero parameters. It
will use input
to ask the user what size and color their bagel should
be, and then draw that bagel. The custom bagel will look just like a
regular bagel once it's drawn.
Hints:
- You will need to convert the size to a number, since
input
always returns a string. - You will have to click on the Thonny window to type in your responses
for the
input
function. - You should call
makeOneBagel
rather than copying and pasting code to draw the bagel.
You can test your function in the shell, or use the prepared line of code
in test_bagels.py
to swap the 3rd bagel for a custom one.
Challenge: Add some random seeds to your bagel*
*Hat tip to Maxine Aguilar and Taylor Balfour for this idea
Here is what the final picture drawn by test_bagels.py
could look like,
including randomly placed "seeds" on the last bagel:

Define a function named makeSeedyBagel
that takes three parameters: a
size, a color, and a seed color. It should add 5 seeds to the bagel in
random positions.
How can we pick something randomly? Python has a built-in random
module
for that. You'll need to import it, just like you've been importing other
modules like turtle
. One of the functions it provides is called
randint
which picks a random integer,
and which can be used to find locations for the seeds. Our
quick-reference page has documentation on a
few other functions in the random
module as well.
Hints:
- Write one function to draw one randomly placed seed
- The image above shows 5 seeds added to the bagel. You could add more or less if you wanted.
- Ideally, seeds should only appear on the body of the bagel, but its okay if yours appear in the "hole"
- Later in the semester, we will learn a better way of adding a whole bunch of seeds (repeating a block of code)
You can test your function in the shell, or use the prepared line of code
in test_bagels.py
to swap the 4th bagel for a seedy one.