|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
题目:
Write a Python program to convert the following two lists into a dictionary called output10.
q10_keys = ["John", "Danise", "David", "Kelly", "Emma", "Olivia"]
q10_values = [12, 10, 9, 19, 30, 33]
我的解答:
q10_keys = ["John", "Danise", "David", "Kelly", "Emma", "Olivia"]
q10_values = [12, 10, 9, 19, 30, 33]
j = 0
output10 = []
for i in q10_keys:
output10.append(f'{i}: {q10_values [j]}')
j += 1
print(output10)
得到:
['John: 12', 'Danise: 10', 'David: 9', 'Kelly: 19', 'Emma: 30', 'Olivia: 33']
我感觉题目不是要的这种格式的列表,但我不知道怎么弄成题目想要的列表格式
求大佬解答 |
|