以下哪遍历字典、依次输出所有键值对里的值的方式是不对的:
A. for key in dict: print(dict[key])
B. for key in dict.keys(): print(dict[key])
C. for key,value in dict.items(): print(value)
D. for value in dict: print(value)
查看答案
aDict = {'age':18,'score':98,'name':'ZhangSan','sex':'male'},和aDict['score'] 结果相同的是( )
A. aDict.score
B. aDict.get('score')
C. aDict.values('score')
D. aDict.key('score')
aDict = {'age':18,'score':98,'name':'ZhangSan','sex':'male'}, 则aDict.popitem()的返回值为( )
A. ('sex':'male')
B. ('name','ZhangSan')
C. ('score',98)
D. ('age',18)
aDict = {'a':10,'b':15,'c':9,'d':31},则aDict.get('a') 的返回值是______________。
aDict = {'a':10,'b':15,'c':9,'d':31},list(aDict.values()) 的返回值是------------。