python算法實戰5

任意三個整數類型,x、y、z

提問:要求把這三個數,按照由小到大的順序輸出 Python解題思路分析:

while 1:
    try:
        x = int(input("plz input x: "))
        y = int(input("plz input y: "))
        z = int(input("plz input z: "))
        list1 = [x, y, z]
        print(sorted(list1))
        break
    except:
        print("請輸入整數")


發佈了101 篇原創文章 · 獲贊 51 · 訪問量 19萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章