Referenced from lesson Histograms
For the word problems below, assume you have animalA
and
animalB
defined in your code.
Directions: Define a function called kilos
, which consumes a Row of the animals table and divides the pounds column by 2.2 to compute the animal’s weight in kilograms.
Contract and Purpose Statement |
Every contract has three parts…
# _____::(r :: Row)->______
# ______________________________________________________________
Examples |
Write some examples, then circle and label what changes…
examples:
_______ (_________)is _______________________
_______ (_________)is _______________________
end
Definition |
Write the definition, giving variable names to all your input values…
fun _____(_):
___________________
end
Directions: Define a function called smart-dot
, which consumes a Row of the animals table and computes the image of a solid red circle using the animal’s pounds
as the radius.
Contract and Purpose Statement |
Every contract has three parts…
# _________::____________________->Image
# Consumes an animal, and computes a solid red circle using the weight in pounds as the radius
Examples |
Write some examples, then circle and label what changes…
examples:
__smart-dot ("animalA") _________is _________________________________________
___________ (_________) _________is _________________________________________
end
Definition |
Write the definition, giving variable names to all your input values…
fun _________(_):
_____________________________________
end
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). Bootstrap:Data Science by Emmanuel Schanzer, Nancy Pfenning, Emma Youndtsmith, Jennifer Poole, Shriram Krishnamurthi, Joe Politz, Ben Lerner, Flannery Denny, and Dorai Sitaram with help from Eric Allatta and Joy Straub is licensed under a Creative Commons 4.0 Unported License. Based on a work at www.BootstrapWorld.org. Permissions beyond the scope of this license may be available by contacting schanzer@BootstrapWorld.org.