1. function : one input get one output

Untitled

Untitled

print(abs(-5))  # 取absolte 絕對值
print(pow(2, 10))  # 次方(指數)函數
print(max(1, 2, 3, 4, 5))  # 取最大值
print(min(1, 2, 3, 4, 5))  # 最最小值
print(round(2.2))
print(round(2.5)) # 2.5 --> 3 非偶數會round down --> 2 
print(round(3.5)) # 3.5 --> 4 是偶數 round up --> 4
# x.5, the values will be rounded up if the roundup value is an even number
# ohterwise, it will be rounded down

--------------------------------------
[Running] python -u "d:\\2022_python_全攻略\\11. Functions for Numbers"
5
1024
5
1
2
2
4

typecasting (轉換資料類型)

Untitled