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:

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: 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:

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"]]