如何将结果写入传递的参数(arguments)?
### permutation function
def xchg(a, b):
""" xchg function that does a permution for two integers
"""
a=a+b
b=a-b
a=a-b
a=int(input("Enter a number: "))
b=int(input("Enter another number: "))
xchg(a,b)
print("a= ", a)
print("b= ", b)
最佳答案
如果您正在学习 Python,您应该学习如何编写 Python,而不是学习如何用 Python 编写 C 或 Java。
在 Python 中,这样做没有意义。好多了:
b, a = a, b
关于python - 将结果写入 Python 中的参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14540226/