将一个字典的键、值互换,例如{160: 'Aric', 168: 'Lily', 155: 'Mary'},转换为{'Aric': 160, 'Lily': 168, 'Mary': 155},下面应填入的代码是()。 d_src = {160: 'Aric', 168: 'Lily', 155: 'Mary'} d_dst = {} for 空1 in 空2 : 空2 print(d_dst) 知识点:字典A.空1:key, value 空2:d_src.items() 空3:d_dst[value] = keyB.空1:key, value 空2:d_src.items() 空3:d_dst[key] = valueC.空1:key 空2:d_src.keys() 空3:d_dst[ d_src[key] ] = keyD.空1:key, value 空2:d_src.values() 空3:d_dst[ value ] = key
将一个字典的键、值互换,例如{160: 'Aric', 168: 'Lily', 155: 'Mary'},转换为{'Aric': 160, 'Lily': 168, 'Mary': 155},下面应填入的代码是()。 d_src = {160: 'Aric', 168: 'Lily', 155: 'Mary'} d_dst = {} for 空1 in 空2 : 空2 print(d_dst) 知识点:字典
A.空1:key, value 空2:d_src.items() 空3:d_dst[value] = key
B.空1:key, value 空2:d_src.items() 空3:d_dst[key] = value
C.空1:key 空2:d_src.keys() 空3:d_dst[ d_src[key] ] = key
D.空1:key, value 空2:d_src.values() 空3:d_dst[ value ] = key
参考答案和解析
空1:key, value 空2:d_src.items() 空3:d_dst[value] = key;空1:key 空2:d_src.keys() 空3:d_dst[ d_src[key] ] = key
相关考题:
9.—Do Lily and Lucy__________,Mary?—Yes,they doA.look sameB.look the sameC. look likeD.look the same as
——Mary, you clean the room today, ?——But I cleaned it yesterday. It’s Lily’s turn.A、don’t youB、will youC、do youD、didn’t you
21. This is ________ room. The twin sisters like it very much.A. Lucy's and Lily'sB. Lucy's and LilyC. Lucy and Lily'sD. Lucy and Lily
单选题某学校10000名女生身高服从正态分布,其均值为160cm,标准差为5cm,其中6827名女生身高的可能范围是( )。A160-165cmB150-170cmC155-165cmD155-160cm
单选题Mary doesn’t like blue _____ red. But _____.Aor; Lily doesBand; does LilyCnor; Lily isDneither; is Lily
单选题三号线正线S700K双机牵引道岔A机开程为:()。A155±2mmB160±2mmC155±5mmD160±5mm