numbers = list(range(1, 99, 2)) print ("原始資料:", numbers) print ("min number:", min(numbers)) print ("min number:", min(10, 20)) print ("max number:", max(numbers)) print ("min number:", max(10, 20)) numbers = sorted(numbers, key=None, reverse=True) print ("反向排序", numbers) numbers = sorted(numbers, key=None, reverse=False) print("正向排序", numbers)
參考資料:
http://docs.python.org/3.3/library/functions.html#min
http://docs.python.org/3.3/library/functions.html#max
http://docs.python.org/3.3/library/functions.html#sorted