Referenced from lesson Data Displays and Lookups

The table below represents four pets:

pets-table

name sex age pounds

"Toggle"

"female"

3

48

"Fritz"

"male"

4

92

"Nori"

"female"

6

35.3

"Maple"

"female"

3

51.6

1) Match each Lookup Question (left) to the code that will give the answer (right).

“How much does Maple weigh?”

1

A

pets-table.row-n(3)

“Which is the last row in the table?

2

B

pets-table.row-n(2)["name"]

“What is Fritz’s sex?”

3

C

pets-table.row-n(1)["sex"]

“What’s the third animal’s name?”

4

D

pets-table.row-n(3)["age"]

“How much does Nori weigh?”

5

E

pets-table.row-n(3)["pounds"]

“How old is Maple?”

6

F

pets-table.row-n(0)

“What is Toggle’s sex?”

7

G

pets-table.row-n(2)["pounds"]

“What is the first row in the table?”

8

H

pets-table.row-n(0)["sex"]

2) Fill in the blanks (left) with code that will produce the value (right).

a.

pets-table.row-n(3)["name"]

"Maple"

b.

"male"

c.

4

d.

48

e.

"Nori"

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). CCbadge 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.