Professional Documents
Culture Documents
8.1 - TraversalsInvestigate
8.1 - TraversalsInvestigate
Work through levels 2, 3, and 4 in App Lab. Complete this worksheet as you progress through the levels.
Level 2: Run the app to see how it works. Think about the purpose of the app, the inputs, the outputs, and
how information might be processed to make the app function.
Read through the entire code then re-read the code for each function. If you have a partner, discuss the code
with them then answer the questions below.
average() (lines 32-38)
slow() (lines 40-48)
fast() (lines 50-58)
numberedListDisplay() (lines 60-66)
● What list does the average() function traverse? The average function traverses mile times.
● What happens within the loop? The mile times are added uo to a total then divided by the total
number of times to find an average.
● What list does the slow() function traverse? It traverses mile times.
● What list does the fast() function traverse? Traverse the mile times.
● What list does the numberedListDisplay() function traverse? This function traverses mile times.
● What happens within the loop? Displays the mile time it was and the time it took to run it.
● What happens within the loop? It adds together the total time of every element in the list
Level 3: Read through the code and run it. Data is printed to the console. Let's see where it came from.
Open the Data tab. Notice that bottom of the screen now shows a Data Library
and a Data Browser.
● What Data Table is available in the Data Browser?
● Click the table name to view the information in the table. What information is available?
● Name one table that you investigated and describe the data in the table.
● Explain how you would filter the Dogs dataset using a traversal to have a filtered list of dogs who live
long lives.
● Traverse through the dataset: Using a loop, go through each dog in the dataset and evaluate if it
meets the criteria defined in step 1. Filter out the desired dogs: For each dog that meets the criteria,
add it to a new filtered list. This filtered list will contain only the dogs who live long lives.