print( zip_lists([1, 2], ["a", "b"], [1.0, 2.0]) ) # [(1, "a", 1.0), (2, "b", 2.0)]
print( zip_lists([], [], []) ) # []Module 11 Assignments
Short Project 09
Due date: Wednesday, November 11, 2026 at 9pm
Programming Problems
Due date: Wednesday, November 11, 2026 at 9pm
Programming Problem 21
Write a Python function that does the following:
- Its name is
zip_lists - It takes three arguments:
list_1,list_2,list_3– all of the same length - It iterates over all three lists (remember, they have the same length, so you can use the same index for all of them) appending to a new list of tuples of three elements
- It returns the list of tuples
Test cases:
Name the program create_tuples.py. Make sure that gradescope gives you the points for passing the test case.
Programming Problem 22
Due date: Wednesday, November 04, 2026 at 9pm
Write a Python function that does the following:
- Its name is
all_mappings - It takes a single
dictionaryas an argument, which maps strings to lists of integers - It returns a list of 2-value tuples, where the first value of the tuples is a key from D, and the second value is an element from its associated list value
Test cases:
print( all_mappings({"a": [7, 3, 1]}) ) # [("a", 7), ("a", 3), ("a", 1)]
print( all_mappings({"a": [8], "b": [2]}) ) # [("a", 8), ("b", 2)]
print( all_mappings({"a": [], "b": [2]}) ) # [("b", 2)]
print( all_mappings({}) ) # []Name the program mappings.py. Make sure that gradescope gives you the points for passing the test case.