Open the Row Functions Starter File on your computer, save a copy, and Click "Run"!
1 Write the code to lookup the value of the weeks
column for each of the rows listed (the first one has been completed for you).
row | code to lookup the value of the weeks column |
---|---|
|
|
|
|
|
2 Write the code that uses the circle
function to draw a solid, green circle whose radius is the number of weeks it took to get adopted (the first one has been completed for you).
row | code to draw a circle using the "weeks" of the row as the radius |
---|---|
|
|
|
|
|
3 Check with your partner or another student to confirm that your code matches.
4 What is the name of the animal defined in old-row
? How many weeks did it take for them to be adopted?
weeks-dot
Scroll down in the Row Functions Starter File until you find the Contract, Purpose, Examples and Definition for weeks-dot
.
5 What is the Domain of this function? The Range? How many examples does this function have?
6 Does the Purpose Statement make it clear what this function should do, when given a Row?
7 Look at the first two examples. How do they satisfy the Contract and Purpose Statement?
These examples show us exactly what should be produced for cat-row
and young-row
- the two Rows representing "Sasha" and "Wade", based on their weeks
to adoption (1
and 3
). But they don’t show us where the computer should get the number of weeks
from!
8 The last two examples do the same thing as the first two examples, but the numbers 3
and 1
have been replaced!
Where do they get the number of weeks from?
9 How is the definition for the weeks-dot
function connected to our examples?
10 Add an example for old-row
to match first pair of examples (using the actual number of weeks). Then add an example for the second pair (using a lookup).
★ Choose one more row that’s defined at the top of the file, and add examples for that as well.
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927). Bootstrap by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.