python--交换变量

x = input('输入 x 值:')
y = input('输入 y 值:')
# 创建临时变量
temp = x
x = y
y = temp
print('交换后x的值为:{}'.format(x), "\n", '交换后y的值为:{}'.format(y))
# 不使用临时变量
x = input('输入 x 值:')
y = input('输入 y 值:')
x, y = y, x
print('交换后x的值为:{}'.format(x), "\n", '交换后y的值为:{}'.format(y))