This lab focuses on the remaining content of AP CSP Big Idea 3: Data. Students use existing online data visualization tools to identifying patterns in data and work collaboratively to draw conclusions and summarize their findings. Several AP-style self-check questions are included to help students extend their understanding to the type of questions likely to appear on the exam.
item of
over their dataset. For example, reports just the MPG of every car in the CORGIS Cars CSV Library. The map
function is simple to understand (e.g, add 3 to every item in the list, or take the fourth item of every record in the table), but it can take time and practice to learn when and how to use it. Encourage students to take that time by talking with their partner, referring back to Unit 3 Lab 2 Page 5: Transforming Every List Item where they first learned map
, and/or talking to other pairs.map
and keep
) to process data and better understand how to use them with a list of lists.split () by (line)
to get the list of items.Pipe. There are, in general, three ways to denote calling a bunch of reporters, each taking the result of the previous one as an input. We generally favor nesting function calls: f(g(x)). The trouble with nesting, for students, is that the function they see first in the code is called last -- it's the innermost function -- g in the f(g(x)) example -- that's called first.
The pipe
is just another representation of the same function calls, but with the one that's called first shown first. It'd be pipe (x) (g) (f)
to compute f(g(x)).
A third way to present the same idea is to use temporary variables to hold intermediate results:
Students can do whatever makes them comfortable, but they should give nesting a try, and give pipe a try, before they settle on sequential set
s of temporary variables. But you can show them a page with the same function done all three ways, and they can use the sequential one to help them understand the other two.