×
Write the following Python code to do the following (Complete ALL of the following using dictionary comprehension
)
[("name", "Elie"), ("job", "Instructor")]
, create a dictionary that looks like this {'job': 'Instructor', 'name': 'Elie'}
(the order does not matter).["CA", "NJ", "RI"]
and ["California", "New Jersey", "Rhode Island"]
return a dictionary that looks like this {'CA': 'California', 'NJ': 'New Jersey', 'RI': 'Rhode Island'}
. You can research the zip
method to help you.{'a': 0, 'e': 0, 'i': 0, 'o': 0, 'u': 0}
. (Do not use the fromkeys
method).chr(65)
to get the first letter):{1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E', 6: 'F', 7: 'G', 8: 'H', 9: 'I', 10: 'J', 11: 'K', 12: 'L', 13: 'M', 14: 'N', 15: 'O', 16: 'P', 17: 'Q', 18: 'R', 19: 'S', 20: 'T', 21: 'U', 22: 'V', 23: 'W', 24: 'X', 25: 'Y', 26: 'Z'}
For solutions to these exercises, click here.
When you're ready, move on to Functions Basics