import re
x, y, z = re.split(',| |,| ', input('請輸入3個數字,用逗號或空格隔開:'))
x, y, z = int(x), int(y), int(z)
maxNo = max(x, y, z)
minNo = min(x, y, z)
print(maxNo, x+y+z-maxNo-minNo, minNo)
# 方法二 用 re.split() 獲得 3 個字符型數字的列表,把字符轉換爲數字,排下序,而後 print() 代碼以下:
import re
lst = re.split(',| |,| ', input('請輸入3個數字,用逗號或空格隔開:'))
for i in range(len(lst)): lst[i] = int(lst[i])lst.sort()print(lst)