Python 练习

1. 题目

两个变量值互换。

2. 分析

3. 实例

点我看答案
def exchange(a, b):
    a, b = b, a
    return a, b


if __name__ == '__main__':
    x = 10
    y = 20
    print(f'x = {x},y = {y}')
    x, y = exchange(x, y)
    print(f'x = {x},y = {y}')

© 2022 刘士. All rights reserved.

结果匹配 ""

    没有匹配的结果 ""