-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassignments-11.qmd
61 lines (43 loc) · 2.24 KB
/
assignments-11.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
title: "Module 11 Assignments"
---
```{r}
#| echo: false
#| message: false
#| warning: false
library(tidyverse)
library(readxl)
assignments <- read_excel("assessment_schedule.xlsx") %>%
mutate(formatted_date = format(due_date, "%A, %B %d, %Y"))
```
# Short Project 09
**Due date: `r assignments %>% filter(assessment == "Module 11 Programming Problems") %>% pull(formatted_date)` at 9pm**
Short Programming projects are submitted during our weekly 45-minute in-person lab sessions. Each lab sessions is guided by two TAs. The instructions for the short project will be available only during the lab sessions. To schedule your lab session go to the weekly lab session spreadsheet in [Short Project Dates and Instructions](short-projects.html).
# Programming Problems
Programming Problems should be submitted to [gradescope](https://www.gradescope.com/courses/934148).
## Programming Problem 21
**Due date: `r assignments %>% filter(assessment == "Module 11 Programming Problems") %>% pull(formatted_date)` at 9pm**
Write a `remove_zero_sides` function that given a 2D list as argument, it **mutates** and returns the list removing any first and last values that are equal to zero. Name your file `filter.py`.
Test cases:
```{python}
#| eval: false
#| echo: true
numbers = [[0, 1, 2], [0], [], [2, 4, 0], [0, 0], [0, 20, 3, 10, 0]]
remove_zero_sides(numbers)
assert numbers == [[1, 2], [], [], [2, 4], [], [20, 3, 10]]
more_numbers = [[0], [], [0, 0], [0, 1], [2, 0]]
assert remove_zero_sides(more_numbers) == [[], [], [], [1], [2]]
```
## Programming Problem 22
**Due date: `r assignments %>% filter(assessment == "Module 11 Programming Problems") %>% pull(formatted_date)` at 9pm**
Write a `lowercase_items` function that given a 2D list of strings as argument, it **mutates** and returns the list lowercasing all strings in each sublist. You can assume all items in the lists are strings. You can use the `.lower()` string method. Name your file `lowercasing.py`
Test cases:
```{python}
#| eval: false
#| echo: true
words = [["A", "B", "C"], [], ["BANANA", "Apple", "pineapple"]]
lowercase_items(words)
assert words == [["a", "b", "c"], [], ["banana", "apple", "pineapple"]]
more_words = [["A"], ["Monica"]]
assert lowercase_items(more_words) == [["a"], ["monica"]]
```