Recent questions tagged goclasses-da-dpp-day-215

1 1 vote
2 2 answers
140
140 views
A grid contains '$\texttt{s}$' for sand, '$\texttt{r}$' for rock, and $\texttt{None}$ for empty.The operation $\texttt{jumpdown(grid, x, n)}$ works on one column $\texttt...
1 1 vote
2 2 answers
117
117 views
Suppose $\texttt{zeroArray(3, 4)}$ creates a $2$D array with $3$ rows and $4$ columns, filled with zeros.Now consider:v = zeroArray(3, 4)Which expression correctly change...
2 2 votes
2 2 answers
121
121 views
Consider the following Python code:def group_by(s, fn): grouped = {} for x in s: key = fn(x) if key in grouped: grouped[key].append(x) else: grouped[key] = [x] return gro...
2 2 votes
2 2 answers
124
124 views
Consider the following Python code:def insert_items(s, before, after): index = 0 while index < len(s): if s[index] == before: s.insert(index + 1, after) index += 1 index ...
2 2 votes
3 3 answers
137
137 views
Consider the following Python code:def remove_dups(L1, L2): for e in L1: if e in L2: L1.remove(e) L1 = [1, 2, 3, 4] L2 = [1, 2, 5, 6] remove_dups(L1, L2) print(L1)What is...
To see more, click for the full list of questions or popular tags.