Python 练习

1. 题目

输入 3 个数 a,b,c,按大小顺序输出

2. 分析

3. 实例

点我看答案
n1 = int(input('n1 = :'))
n2 = int(input('n2 = :'))
n3 = int(input('n3 = :'))


def swap(p1, p2):
    return p2, p1


if n1 > n2:
    n1, n2 = swap(n1, n2)
if n1 > n3:
    n1, n3 = swap(n1, n3)
if n2 > n3:
    n2, n3 = swap(n2, n3)

print(n1, n2, n3)

© 2022 刘士. All rights reserved.

结果匹配 ""

    没有匹配的结果 ""