1.该程序用到字典的浅拷贝和深拷贝,已知程序运行结果,请将程序填写完整。import copyd1={'name':"zhangsan",'sno':"001",'score':{'math':99,'C++':88}}d2=d3=d1['name']="li"d1['score']['C++']=90print(d1)print(d2)print(d3)已知程序运行结果为:{'name': 'li', 'sno': '001', 'score': {'math': 99, 'C++': 90}}{'name': 'zhangsan', 'sno': '001', 'score': {'math': 99, 'C++': 90}}{'name': 'zhangsan', 'sno': '001', 'score': {'math': 99, 'C++': 88}}
查看答案
写出下面程序的运行结果。t1=("zhangsan",18,95.5)t2=()t3=(33,)t4=([44,55,66])t5=t1+t3print(t1,t2,t3,t4,t5)print(t5)print(max(t4))print(min(t4))
写出下面程序的运行结果。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)