介紹在Python 中如何排序數值、文字,以及反向排序、自訂排序鍵值函數。 ... x = [4, 2, 5, 3, 1] # 排序並建立新的List y = sorted(x) print(y) [1, 2, 3, 4, 5].
確定! 回上一頁