已知2020年10月份京东商城手机销量排行榜单中,华为68.2万部,小米52.5万部,Apple35.9万部,用一个列表phonelist来保存这些销量数据,即phonelist=[('华为',68.2), ('小米':52.5), ('Apple':35.9)],则下列程序语句执行后,变量x和变量y分别是什么?x,y=phonelist [1]
A. x为'华为', y为68.2
B. x为'小米', y为52.5
C. x为68.2, y为'华为'
D. x为52.5, y为'小米'
查看答案
已知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]