Professional Documents
Culture Documents
EEA216 資料結構
Data Structure
Lecture 6
Yu-Hui Huang, Data Structure
Yu-Hui Huang
Oot. 3, 2022
L4: Exercise 1: Dictionary
Write a python function to map two given
lists into a dictionary. #Test case:
Input: [“a”,”b”,”c”], [35, 20, 10]
Output: {'a': 35, 'c': 20, 'b': 10}
def toDict(key,val):
return dict(zip(key,val))
Output:
T 3
O 4
B 2
E 3
R 2
N 1
Yu-Hui Huang, Data Structure 9