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 age
column for each of the rows listed (the first one has been completed for you).
row | code to lookup the value of the age column |
---|---|
|
|
|
|
|
2 Write the code that uses the triangle
function to draw a solid, green triangle whose size is 5 times the age of the animal (the first one has been completed for you).
row | code to draw a triangle using 5 times the "age" 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 years old are they?
5 How large would you expect their triangle to be?
age-gt
Scroll down in the Row Functions Starter File until you find the Contract, Examples and Definition for age-gt
.
6 What is the Domain of age-gt
? The Range? How many examples are provided?
7 According to the comment below the Contract, what should this function do, when given a Row?
Notice: The first two examples use cat-row
and dog-row
. And so do the third and fourth examples!
8 Which pair of examples does the definition look more like?
9 Why is it helpful to include the first two examples?
10 Why can’t we write our definition using only the first two examples?
11 In the last two examples the numbers 3
and 1
have been replaced! Where do these examples get the numbers from?
12 Add an example for old-row
to match the first pair of examples (using the actual number of age).
13 Then add an example old-row
to match the second pair of examples (using a lookup).
★ Add another pair of examples using a row of your choosing from the definitions at the top of the file.
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.