已知2020年10月份京东商城手机销量排行榜单中,华为68.2万部,小米52.5万部,Apple35.9万部,用一个列表phonelist来保存这些销量数据,即phonelist=[('华为',68.2), ('小米':52.5), ('Apple':35.9)],则执行下列程序后,字典变为什么? ________phoneDict={'华为':68.2, '小米':52.5,'Apple':35.9}for item in ['华为', '小米', 'Apple', 'vivo']:phoneDict [item]= phoneDict.get(item, 10)print(phoneDict)
A. {'华为':10, '小米':10,'Apple':10}
B. {'华为':68.2, '小米':52.5,'Apple':35.9}
C. {'华为':68.2, '小米':52.5,'Apple':35.9,'vivo':0}
D. {'华为':68.2, '小米':52.5,'Apple':35.9,'vivo':10}
查看答案
下面代码的输出结果是: 15 。mylist = [[1,2,3],[4,5,6],[7,8,9]]sum1 =0for i in range(3):sum1 = sum1 + mylist [i][i]print("sum1={}".format(sum1))
下面代码的输出结果是:。a = [3,5,8,9,1]n = len(a)m = len(a)//2for i in range(m):a[i],a[n-i-1] = a[n-i-1],a[i]print(a])
下面代码的输出结果是:________。mylist = [83,60,100,55]degree = "DCBAAF"for score in mylist:index = (score - 60)//10if index >= 0:print(degree[index])else:print(degree[-1]
下面代码的输出结果是:____________。ls = [i*2+1 for i in range(5)]print(ls)
A. [1, 3, 5, 7, 9]
B. [1, 2, 3, 4, 5]
C. [ 3, 5, 7, 9, 11]
D. [2, 4, 6, 8, 10]