代码拉取完成,页面将自动刷新
# 首先把昨天没有写完的作业继续写,今天没有写完的明天可以继续写
#
# 1.有如下
# v1 = {'郭宝元','alex','板哥','王二麻子'}
# v2 = {'alex','王二麻子'}
# 请得到 v1 和 v2 的交集并输出 {alex,王二麻子}
# 请得到 v1 和 v2 的并集并输出 {'郭宝元','alex','板哥','王二麻子'}
# 请得到 v1 和 v2 的 差集并输出 none
# 请得到 v2 和 v1 的 差集并输出 {郭宝元,板哥}
#
# 2.循环提示用户输入,如果输入的内容在v1中存在,则追加到v2中,如果v1中不存在,则添加到v1中。
# (如果输入N或n则停止循环)
#
# 3.is 和 == 的区别?
# is 内存地址相同
# == 完全相同
#
# 4.type和id的作用?
# 5.看代码写结果并解释原因
#
# v1 = {'k1':'v1','k2':[1,2,3]}
# v2 = {'k1':'v1','k2':[1,2,3]}
# result1 = v1 == v2
# result2 = v1 is v2
# print(result1) true
# print(result2) false
# 6.看代码写结果并解释原因
#
# v1 = {'k1':'v1','k2':[1,2,3]}
# v2 = v1
# result1 = v1 == v2
# result2 = v1 is v2
# print(result1) true
# print(result2) false
# 7.看代码写结果并解释原因
#
# v1 = {'k1':'v1','k2':[1,2,3]}
# v2 = v1
# v1['k1'] = 'meet'
# print(v2)
#
# {'k1':'meet','k2':[1,2,3]}
# 8.看代码写结果并解释原因
#
# v1 = '人生苦短,我用Python'
# v2 = [1,2,3,4,v1]
# v1 = "人生苦短,用毛线Python"
# print(v2)
# v2 = [1,2,3,4,'人生苦短,我用Python']
# 9.看代码写结果并解释原因
#
# info = [1,2,3]
# userinfo = {'account':info, 'num':info, 'money':info}
# info.append(9)
# print(userinfo)
# info = "题怎么这么多"
# print(userinfo)
# 10.看代码写结果并解释原因
#
# info = [1,2,3]
# userinfo = [info,info,info,info,info]
# info[0] = '不仅多,还特么难呢'
# print(info,userinfo)
# 11.看代码写结果并解释原因
#
# info = [1,2,3]
# userinfo = [info,info,info,info,info]
# userinfo[2][0] = '他扒拉我'
# print(info,userinfo)
# 12.看代码写结果并解释原因
#
# data = {}
# for i in range(10):
# data['user'] = i
# print(data)
# 13.看代码写结果并解释原因
#
# data_list = []
# data = {}
# for i in range(10):
# data['user'] = i
# data_list.append(data)
# print(data_list)
# 14.看代码写结果并解释原因
#
# data_list = []
# for i in range(10):
# data = {}
# data['user'] = i
# data_list.append(data)
# print(data_list)
# 15.看代码写结果(以下内容如果不是很清楚的多画画图)
#
# v1 = [1,2,3,4,5]
# v2 = [v1,v1,v1]
# v1.append(6)
# print(v1)
# print(v2)
# 16.看代码写结果
#
# v1 = [1,2,3,4,5]
# v2 = [v1,v1,v1]
# v2[1][0] = 111
# v2[2][0] = 222
# print(v1)
# print(v2)
# 17.看代码写结果,并解释每一步的流程。
#
# v1 = [1,2,3,4,5,6,7,8,9]
# v2 = {}
# for item in v1:
# if item < 6:
# continue
# if 'k1' in v2:
# v2['k1'].append(item)
# else:
# v2['k1'] = [item]
# print(v2)
# 18.看代码写结果
#
# import copy
# v1 = "alex"
# v2 = copy.copy(v1)
# v3 = copy.deepcopy(v1)
# print(v1 is v2)
# print(v1 is v3)
# 19.看代码写结果
#
# import copy
# v1 = [1,2,3,4,5]
# v2 = copy.copy(v1)
# v3 = copy.deepcopy(v1)
# print(v1 is v2)
# print(v1 is v3)
# 20.看代码写结果
#
# import copy
# v1 = [1,2,3,4,5]
# v2 = copy.copy(v1)
# v3 = copy.deepcopy(v1)
#
# print(v1[0] is v2[0])
# print(v1[0] is v3[0])
# print(v2[0] is v3[0])
# 21.看代码写结果
#
# import copy
# v1 = [1,2,3,4,[11,22]]
# v2 = copy.copy(v1)
# v3 = copy.deepcopy(v1)
#
# print(v1[-1] is v2[-1])
# print(v1[-1] is v3[-1])
# print(v2[-1] is v3[-1])
# 22.看代码写结果
#
# import copy
#
# v1 = [1,2,3,{"name":'宝元',"numbers":[7,77,88]},4,5]
# v2 = copy.copy(v1)
#
# print(v1 is v2)
#
# print(v1[0] is v2[0])
# print(v1[3] is v2[3])
#
# print(v1[3]['name'] is v2[3]['name'])
# print(v1[3]['numbers'] is v2[3]['numbers'])
# print(v1[3]['numbers'][1] is v2[3]['numbers'][1])
# 23.看代码写结果
#
# import copy
# v1 = [1,2,3,{"name":'宝元',"numbers":[7,77,88]},4,5]
# v2 = copy.deepcopy(v1)
# print(v1 is v2)
# print(v1[0] is v2[0])
# print(v1[3] is v2[3])
#
# print(v1[3]['name'] is v2[3]['name'])
# print(v1[3]['numbers'] is v2[3]['numbers'])
# print(v1[3]['numbers'][1] is v2[3]['numbers'][1])
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。