Question: Write a Python function that does the following: Its name is all _ mappings It takes a single dictionary as an argument, which maps strings

Write a Python function that does the following:
Its name is all_mappings
It takes a single dictionary as 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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!