【发布时间】:2020-09-22 23:31:46
【问题描述】:
这是我尝试使用的 2 个列表:
names = ['joe', 'tom', 'barb', 'sue', 'sally']
scores = [10, 23, 13, 18, 12]
我正在使用我创建的名为 makeDictionary 的函数,其参数为 (list1, list2)。
我不想要代码中的直接答案,但是如何让names 列出字典中的键,而scores 列出字典中的值?
示例输出字典:
{'joe': 10, 'tom': 23, 'barb': 13, 'sue': 18, 'sally': 12}
【问题讨论】:
标签: python list function dictionary