= [[0, 1, 2], [0], [], [2, 4, 0], [0, 0], [0, 20, 3, 10, 0]]
numbers
remove_zero_sides(numbers)assert numbers == [[1, 2], [], [], [2, 4], [], [20, 3, 10]]
= [[0], [], [0, 0], [0, 1], [2, 0]]
more_numbers assert remove_zero_sides(more_numbers) == [[], [], [], [1], [2]]
Module 11 Assignments
Short Project 09
Due date: Nov 12, Tuesday at 7pm
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.
Programming Problems
Programming Problems should be submitted to gradescope.
Programming Problem 21
Due date: Nov 12, Tuesday at 7pm
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:
Programming Problem 22
Due date: Nov 12, Tuesday at 7pm
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:
= [["A", "B", "C"], [], ["BANANA", "Apple", "pineapple"]]
words
lowercase_items(words)assert words == [["a", "b", "c"], [], ["banana", "apple", "pineapple"]]
= [["A"], ["Monica"]]
more_words assert lowercase_items(more_words) == [["a"], ["monica"]]