Challenge Question 04 - Dict Function Writing


Instructions

Write a function definition with the following expectations:

  • The function name is zip and is called with a list[str] and list[int] as arguments.
  • The function should return a dict[str,int].
  • The function should produce a dictionary where the keys are the items of the first list and the values are the corresponding items at the same index of the second list.
  • If the input lists are different lengths or if they are empty, the function should return an empty dictionary.
  • The function should not mutate (modify) the input lists.
  • Explicitly type variables, parameters, and return types. (The autograder won’t check for this, but it’s good practice for the quiz!)
  • Save your file as zip.py.

Upload your zip.py file to the autograder on Gradescope. You do not have to compress anything using the submission script! Just drag and drop the one zip.py file!

Contributor(s): Alyssa Byrnes