VOCABULARY
TABLE FUNCTIONS
CONTRACTS & CODE
DATA DISPLAYS
100

4 types of data that Pyret understands.

What are NUMBERS, "STRINGS", BOOLEANS AND IMAGES.

100

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")

100

The Domain of the radial-star function


What is Number, Number, Number, String, String?

100

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

200

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?

200

 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)

200

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

200
the code for an image-scatter-plot of the weight of an animal as the explanatory variable and weeks to adoption as the response variable, using the species-tag function to label each point with the species of the animal.

image-scatter-plot(animals-table, "pounds", "weeks", species-tag)

300

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?

300

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)

300

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

300

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")



400

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?

400

Tell pyret to tell you what is in the pct-obese column for the row defined as BX.

BX["pct-obese"]

400

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

400

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)