--- title: Drill 7 Solution tags: Drills-F20, 2020 --- # Drill 7 Solution For each question below, select all of the functions you would need in order to solve the problem. Some problems require only one of the functions, while some require more. All of the functions ask you to consider a table with the following structure: | A | B | |-----|-----| | 3 | 1 | | 5 | 9 | | 10 | 4 | | ... | ... | ## Question 1 Find the rows of the table where the value in column "A" is less than the value in column "B" [ ] sort-by [ ] filter-with [ ] build-column [ ] transform-column ::: spoiler Answer [ ] sort-by [X] filter-with [ ] build-column [ ] transform-column This is a filtering operation--you want to return a table with some, but not all, of the rows in the original table. ::: ## Question 2 Add a new column which is the sum of column "A" and column "B" for each row [ ] sort-by [ ] filter-with [ ] build-column [ ] transform-column ::: spoiler Answer [ ] sort-by [ ] filter-with [X] build-column [ ] transform-column You can add new columns with build-column. ::: ## Question 3 Clean up the data in column "A" by setting column "A" to 0 wherever it is less than zero, then order the rows by the value in column "A" in ascending order [ ] sort-by [ ] filter-with [ ] build-column [ ] transform-column ::: spoiler Answer [X] sort-by [ ] filter-with [ ] build-column [X] transform-column This problem requires you to transform a column, then sort by that column. ::: ## Question 4 Multiply every value in column "A" by 2, then add a new column which is the value in column "B" plus 3. [ ] sort-by [ ] filter-with [ ] build-column [ ] transform-column :::spoiler Answer [ ] sort-by [ ] filter-with [X] build-column [X] transform-column This problem requires you to transform column "A", then add a new column. ::: ## Question 5 Divide every value in column "A" by 2, remove rows where column "A" isn't an integer, add a column which is the product of column "A" and column "B", and then order the rows by the value of column "B" in descending order [ ] sort-by [ ] filter-with [ ] build-column [ ] transform-column :::spoiler Answer [X] sort-by [X] filter-with [X] build-column [X] transform-column :::