# coding: utf-8
# 面试题:交换两个数字
a = 6
b = 100
# solution 1
# c = a
# a = b
# b = c
# solution 2
# a = a + b
# b = a - b
# a = a - b
# solution 3
a, b = b, a
print a, b
Python学习 - 面试题:交换两个数字
最新推荐文章于 2023-06-10 01:01:57 发布
# coding: utf-8
# 面试题:交换两个数字
a = 6
b = 100
# solution 1
# c = a
# a = b
# b = c
# solution 2
# a = a + b
# b = a - b
# a = a - b
# solution 3
a, b = b, a
print a, b