@extends('template') @section('title') Lab 2: Extra bagels @stop @section('content') # Lab 2: Extra bagels These extra exercises build on the [bagels functions](bagels); if you haven't finished that part you should do that first. ## Create a made-to-order custom bagel
Partner A
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: 1. You will need to convert the size to a number, since `input` always returns a string. 2. You will have to click on the Thonny window to type in your responses for the `input` function. 3. 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
Partner B
Here is what the final picture drawn by `test_bagels.py` could look like, including randomly placed "seeds" on the last bagel: Four bagels, the first one just an orange-red circle, the second light blue with a bite taken out, the third light green, and the fourth beige with five black seeds scattered randomly on it. 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`](/reference/quickref#randint) which picks a random integer, and which can be used to find locations for the seeds. [Our quick-reference page](/reference/quickref#seed) has documentation on a few other functions in the `random` module as well. Hints: 1. Write one function to draw one randomly placed seed 2. The image above shows 5 seeds added to the bagel. You could add more or less if you wanted. 3. Ideally, seeds should only appear on the body of the bagel, but its okay if yours appear in the "hole" 4. 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. @include('/labs/lab02/_toc') @stop