三个数值用min函数取最小值,然后使用比较的方法找出最小值是哪一个,用remove删除最小值,剩余数值经行比较。
a=float(input('请输入数值:'))
b=float(input('请输入第二个数字:'))
c= float(input('请输入第三个数字:'))
z=[a,b,c]
mn=min(a,b,c)
if mn == a:
z.remove(a)
if b>=c:
print(mn,c,b)
else:
print(mn,b,c)
elif mn ==b:
z.remove(b)
if a>=c:
print(mn,c,a)
else:
print(mn,a,c)
elif mn ==c:
z.remove(c)
if a>=b:
print(mn,b,a)
else:
print(mn,a,b)
print()