print(num1)
print(num2)
#实现拆包过程
#字典
dict={'name':'tom','age':28}
a,b=dict
print(a)
print(b)
print(dict[a])
print(dict[b])
print('_'*30)
#交换变量值
a,b=1,2
a,b=b,a
print(a)
print(b)
#引用
#值是依靠引用传递来的:我们可以用id()来判断两个变量是否为同一个值得引用,我们可以将id值理解为那块在内存的地址标识
a=1
b=a
print(b)
print(id(a))
print(id(b))#是一致的
#列表
aa=[10,20]
bb=aa
print(id(aa))
print(id(bb))##相等的
print()
#引用做实参
def test1(a):
print(a)
print(id(a))
a+=a
print(a)
print(id(a))
b=100
test1(b)
print()
#可变与不可变类型:数据能够直接进行修改
#可变:列表 字典 集合
#不可变:整型 浮点 字符串 元祖 ——修改时不修改原来的数据
结果:
100
100 120 120
100 500 500
50 (1, 2) 您的姓名是tom,年龄是28,性别是男 您的姓名是rose,年龄是28,性别是男 您的姓名是fuck,年龄是28,性别是男 ('tom',) ('rose', 27) {'name': 'tom', 'age': 18, 'ID': 110} ____________________
100 200 name age tom 28 ______________________________ 2 1 1 140715783231136 140715783231136 1791657756672 1791657756672
100 140715783234304 200 140715783237504