劉子鳴python內建built-in函數function迴圈loop範圍range
程式碼
print("練習函數abs, all, any, ascii")
for i in range(-2,3):
x = abs(i)
print(abs(x))
print("all邏輯,是否全部是真?")
x, y, z = 1==1, 2>1, 3>2 #=給值,==判斷
print(all([x,y,z]))
print("2>1,-1==1,-2>3有正確的嗎",any([2>1, -1==1, -2>3]))
print("2>1,-1==1,-2>3全正確嗎",all([2>1, -1==1, -2>3]))
#pthon註解range(開始,結束)
print("列印,迴圈for, range範圍")
for i in range(33301, 33344):
print("字碼character", i,"是",chr(i))
for i in range(65, 70):
print(chr(i))w3school內建函數列表
https://www.w3schools.com/python/python_ref_functions.aspPython has a set of built-in functions.
留言
張貼留言