4 types of data that Pyret understands.
What are NUMBERS, "STRINGS", BOOLEANS AND IMAGES.
Write code to find the average percent of people who smoke (pct-smoke) in all counties in the health-table.
Use the mean function. Here's the contract:
# mean :: (Table, String) --> Number
mean(counties-table, "pct-smoke")
The Domain of the radial-star function

What is Number, Number, Number, String, String?
The definition of a function called species-tag, which takes in a row from the Animals-table and draws its species in red, 15px letters.
fun species-tag(r): text(r["species"], 15, "red") end
Values that MEASURE how much of something there is are called ___________, while values that DESCRIBE something with a name or label are called ____________________.
What are QUANTITATIVE DATA and CATEGORICAL DATA?
Sort the counties in the health-table by the percent of children living in poverty (pct-child-pov) from least to greatest, and get a table with the 3 counties with the lowest percentages.
first-n-rows(sort(health-table, "pct-child-pov", true),3)
The definition of a function called name-color, which makes an image of your name at size 50 in whatever color is given.
fun name-color(color): text("yourname", 50, color) end
image-scatter-plot(animals-table, "pounds", "weeks", species-tag)
A statement of the name, domain, and range of a function for humans to read so they can create an output
What is a CONTRACT?
Define a table called NY-health-table that filters the health-table using the is-NY function.
NY-health-table = filter(health-table, is-NY)
Define a function called is-NY that looks in every row, in the "state" column of the health table to see if it says "New York".
What is
fun is-NY(r): r["state"] == "New York" end
Write three conditional statements for a function called water-dot that will look in the H20-V column of the health table and will make a 5px solid, red square if a county does have a water violation (true) or a 5 px, solid, green square if a county does not have a water violation (false).
if (r["h20-v"] == true): square(5, "solid", "red")
else if (r["h20-v"] == false): square(5, "solid", "green")
If --> then statement
These help pyret know where to look in a table, what to look for, and what to do if it finds a certain condition.
These are used when you have a ______________ function.
What is a conditional statement?
What is a piecewise function?
Tell pyret to tell you what is in the pct-obese column for the row defined as BX.
BX["pct-obese"]
Define a function called days-to-adopt that will look in every row and turn the number of weeks it takes an animal to get adopted into days.
fun days-to-adopt(r): r["weeks"] * 7 end
the code for an image-histogram of the players ages in the finals-table with a bin size of 2 and the team-img sticker.
image-histogram(finals-table, "age", 2, team-img)