Referenced from lesson Data Displays and Lookups (Spring, 2021)

Consider the table below, and the four value definitions that follow:

shapes-table

name corners is-round

"triangle"

3

false

"square"

4

false

"rectangle"

4

false

"circle"

0

true

shapeA = shapes-table.row-n(0)
shapeB = shapes-table.row-n(1)
shapeC = shapes-table.row-n(2)
shapeD = shapes-table.row-n(3)

1 Match each Pyret expression (left) to the description of what it evaluates to (right).

shapeD

1

A

Evaluates to 4

shapeA

2

B

Evaluates to the last row in the table

shapeB["corners"]

3

C

Evaluates to "square"

shapeC["is-round"]

4

D

Evaluates to true

shapeB["name"]

5

E

Evaluates to false

shapeA["corners"]

6

F

Evaluates to 3

shapeD["name"] == "circle"

7

G

Evaluates to the first row in the table

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

a.

"rectangle"

b.

"square"

c.

4

d.

0

e.

true

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