题目内容

写出下面程序的运行结果。ls=[1,2,3,2,3,4]print(ls.index(4))print(ls.count(3))print(max(ls))print(min(ls))print(len(ls))del ls[3]print(ls)ls.sort(reverse=True)print(ls)

查看答案
更多问题

写出下面程序的运行结果。import copys1=[4,5,6]s2=s1s2[1]="nk"print(s1,s2)s3=s1[1:3]s3[1]="cn"print(s1,s3)s4=copy.deepcopy(s1)s4[1]=333print(s1,s4)s5=[4,[5,6]]s6=s5[1:3]s5[1][0]="cn"print(s5,s6)s7=copy.deepcopy(s5)s7[1]="nk"print(s5,s7)

写出下面程序的运行结果。s1={1,2,3}s2=set([2,3,3,4])s1.add(3)s2.update('ab')s3=s1.intersection(s2)s4=s1.union(s2)s5=s1.difference(s2)s6=s1.symmetric_difference(s2)print(s1)print(s2)print(s3)print(s4)print(s5)print(s6)

写出下面程序的运行结果。d1={'name':"zhangsan",'sno':"001",'score':99}d2=dict().fromkeys(['radius','height'],0)print(d1)print(d2)d1.update({'age':19})d2.update(radius=10)print(d1)print(d2)del d1['age']height=d2.pop('height','not found')print(d1)print(d2)print(height)print(len(d1))print(len(d2))

写出下面程序的运行结果。s1=[1,2,3,4,5,6,7,8,9,10]s2=list(range(10,20))s3=s1[2:8:2]s4=s2[-8::-2]print(s1)print(s2)print(s3)print(s4)

答案查题题库