交换两个变量的值 a = 2 b = 1 b = 1 a = 2 #方式一: b,a = a,b #交换两个变量的值 print(a,b) #方式二: a = a + b #3 b = a - b #2 a = a - b #3-2 #列表推导式 nums = [0,1,3,4,5,6,7] new_nums = [x-1 for x in nums] print(new_nums) return多个值 函数如果有多个return值,那么会把这几个return的值都放到一个元组里面,然后返回 d…