字典dic1={‘宝藏1’:800, ‘宝藏2’ :1200, ‘宝藏3’ :2000, ‘宝藏4’ :300,‘宝藏5’ :500, ‘宝藏6’ :1000, ‘宝藏7’ :600} 下面哪个程序可输出如下的格式:宝藏1 800宝藏2 1200宝藏3 2000宝藏4 300宝藏5 500宝藏6 1000宝藏7 600
A. dic1={‘宝藏1’:800,’宝藏2’:1200, ‘宝藏3’:2000,’宝藏4’:300, ‘宝藏5’:500,’宝藏6’:1000}for d in dic1:print(d)
B. dic1={‘宝藏1’:800,’宝藏2’:1200, ‘宝藏3’:2000,’宝藏4’:300, ‘宝藏5’:500,’宝藏6’:1000}for d in dic1:print(dic1[d])
C. dic1={‘宝藏1’:800,’宝藏2’:1200, ‘宝藏3’:2000,’宝藏4’:300, ‘宝藏5’:500,’宝藏6’:1000}for d in dic1:print(d,dic1[d])
D. 以上都不对
把各宝藏的相关信息保存在下面的字典result中:result={‘宝藏数’: 7,‘宝藏列表’: [{‘宝藏名称’: ‘宝藏1’,’所在城堡’: ‘修加特’, ‘坐标’:{‘x’: 20, ‘y’: 500}, ‘收入’:800},{‘宝藏名称’: ‘宝藏2’,’所在城堡’: ‘卢云’, ‘坐标’:{‘x’: -20, ‘y’: 260}, ‘收入’:1200},{‘宝藏名称’: ‘宝藏3’,’所在城堡’: ‘古鲁丁’, ‘坐标’:{‘x’:-150, ‘y’:-50}, ‘收入’:2000},{‘宝藏名称’: ‘宝藏4’,’所在城堡’: ‘狄恩’, ‘坐标’:{‘x’:-50, ‘y’:-400}, ‘收入’:300},{‘宝藏名称’: ‘宝藏5’,’所在城堡’: ‘高达德’, ‘坐标’:{‘x’:100, ‘y’:300}, ‘收入’: 500},{‘宝藏名称’: ‘宝藏6’,’所在城堡’: ‘亚丁’, ‘坐标’:{‘x’:150, ‘y’:120}, ‘收入’: 1000},{‘宝藏名称’: ‘宝藏7’,’所在城堡’: ‘奇岩’, ‘坐标’:{‘x’:-100, ‘y’:-100}, ‘收入’:600},] }如果要输出result中的宝藏数,可以用下面哪个语句实现:
A. print('宝藏数')
B. print(result('宝藏数'))
C. print(result{'宝藏数'})
D. print(result['宝藏数'])
把各宝藏的相关信息保存在下面的字典result中:result={‘宝藏数’: 7,‘宝藏列表’: [{‘宝藏名称’: ‘宝藏1’,’所在城堡’: ‘修加特’, ‘坐标’:{‘x’: 20, ‘y’: 500}, ‘收入’:800},{‘宝藏名称’: ‘宝藏2’,’所在城堡’: ‘卢云’, ‘坐标’:{‘x’: -20, ‘y’: 260}, ‘收入’:1200},{‘宝藏名称’: ‘宝藏3’,’所在城堡’: ‘古鲁丁’, ‘坐标’:{‘x’:-150, ‘y’:-50}, ‘收入’:2000},{‘宝藏名称’: ‘宝藏4’,’所在城堡’: ‘狄恩’, ‘坐标’:{‘x’:-50, ‘y’:-400}, ‘收入’:300},{‘宝藏名称’: ‘宝藏5’,’所在城堡’: ‘高达德’, ‘坐标’:{‘x’:100, ‘y’:300}, ‘收入’: 500},{‘宝藏名称’: ‘宝藏6’,’所在城堡’: ‘亚丁’, ‘坐标’:{‘x’:150, ‘y’:120}, ‘收入’: 1000},{‘宝藏名称’: ‘宝藏7’,’所在城堡’: ‘奇岩’, ‘坐标’:{‘x’:-100, ‘y’:-100}, ‘收入’:600},] }如果要输出宝藏3所在的城堡名称,可以用下面哪个语句实现:
A. print(result('宝藏列表')[3]('所在城堡'))
B. print(result['宝藏列表'][3]('所在城堡'))
C. print(result('宝藏列表')[2]('所在城堡'))
D. print(result['宝藏列表'][2]['所在城堡'])
把各宝藏的相关信息保存在下面的字典result中:result={‘宝藏数’: 7,‘宝藏列表’: [{‘宝藏名称’: ‘宝藏1’,’所在城堡’: ‘修加特’, ‘坐标’:{‘x’: 20, ‘y’: 500}, ‘收入’:800},{‘宝藏名称’: ‘宝藏2’,’所在城堡’: ‘卢云’, ‘坐标’:{‘x’: -20, ‘y’: 260}, ‘收入’:1200},{‘宝藏名称’: ‘宝藏3’,’所在城堡’: ‘古鲁丁’, ‘坐标’:{‘x’:-150, ‘y’:-50}, ‘收入’:2000},{‘宝藏名称’: ‘宝藏4’,’所在城堡’: ‘狄恩’, ‘坐标’:{‘x’:-50, ‘y’:-400}, ‘收入’:300},{‘宝藏名称’: ‘宝藏5’,’所在城堡’: ‘高达德’, ‘坐标’:{‘x’:100, ‘y’:300}, ‘收入’: 500},{‘宝藏名称’: ‘宝藏6’,’所在城堡’: ‘亚丁’, ‘坐标’:{‘x’:150, ‘y’:120}, ‘收入’: 1000},{‘宝藏名称’: ‘宝藏7’,’所在城堡’: ‘奇岩’, ‘坐标’:{‘x’:-100, ‘y’:-100}, ‘收入’:600},] }如果要输出宝藏4所在的城堡的x坐标,可以用下面哪个语句实现:
A. print(result('宝藏列表')[4]('坐标')('x'))
B. print(result['宝藏列表'][4]['坐标']['x'])
C. print(result('宝藏列表')[3]('坐标')('x'))
D. print(result['宝藏列表'][3]['坐标']['x'])