--- title: Drill 8 Solution tags: Drills-F20, 2020 --- # Drill 8 Solution For all of these questions, assume we have ``` import lists as L ``` at the top of our Definitions window. ## Question 1 Assume we have some list `li`. Write an expression that evaluates to a Boolean that indicates whether `li` contains the Number `29`. ::: spoiler Answer L.member(li, 29) ::: ## Question 2 Assume we have some list `temps` containing temperature readings in degrees Fahrenheit. Which operations would we use to convert all of the temps to Celsius? [ ] filter [ ] distinct [ ] member [ ] map [ ] length ::: spoiler Answer [ ] filter [ ] distinct [ ] member [X] map [ ] length ::: ## Question 3 Assume we have some list `temps` containing temperature readings in degrees Fahrenheit. Which operations would we use to find the temperatures below freezing? [ ] filter [ ] distinct [ ] member [ ] map [ ] length ::: spoiler Answer [X] filter [ ] distinct [ ] member [ ] map [ ] length ::: ## Question 4 Assume we have some list `temps` containing temperature readings in degrees Fahrenheit. Which operations would we use to round all of the temps to the nearest whole number? [ ] filter [ ] distinct [ ] member [ ] map [ ] length :::spoiler Answer [ ] filter [ ] distinct [ ] member [X] map [ ] length ::: ## Question 5 Assume you are given a list of strings and want the number of unique strings, considering two strings to be the same if they have the same letters but perhaps different capitalization. Which of the following list functions would you expect to need for this computation? [ ] L.filter [ ] L.map [ ] L.distinct [ ] L.length [ ] L.member :::spoiler Answer [ ] L.filter [X] L.map [X] L.distinct [X] L.length [ ] L.member :::