Python--函数return多个值
# 函数如果有多个return值,那么会把这几个return值放到一个元组里面返回
# def hello(a, b, c, d):
# return a, b, c, d
#
# res = hello('abc', 'ert', 'qwe', 'lkj')
# print(res)
# 列表推导式
nums = [0, 1, 3, 4, 5, 6, 7]
# nums = ['0', '1', '3']将里面int变为字符串类型
new_nums = [str(x) for x in nums]
print(new_nums)
# 交换变量值
a = 1
b = 2
# a, b = b, a
# print(a, b)
# 针对整数,小数等可以用此方法,str不适用
a = a + b
b = a - b
a = a - b
print(a, b)