iT邦幫忙

2021 iThome 鐵人賽

DAY 3
0
自我挑戰組

Python 基礎學習之旅系列 第 3

Day-3 Python Bool 整數 整數運算

  • 分享至 

  • twitterImage
  •  

接著針對資料型態為數字進行說明:

Bool

資料型態為: True 與 False
使用 bool() ,可以將任何資料型態轉換成Bool
https://ithelp.ithome.com.tw/upload/images/20210917/20130598EFGy8NcIwL.png

Integer

0後面不能再接數字

https://ithelp.ithome.com.tw/upload/images/20210917/20130598P4mqPACdpq.png

正符號(+) 、負符號(-)

https://ithelp.ithome.com.tw/upload/images/20210917/20130598jqkt3eP0iP.png

使用底線()字元做數字分隔符號
https://ithelp.ithome.com.tw/upload/images/20210917/20130598PgCPrDC8d7.png

運算子

優先順序為乘法的優先順序高於加法,跟其他語法一樣使用小括號(),可作程式碼分組運作。
運算子 說明 + 加法 、- 減法、 *乘法 、 /浮點除法 、/整數(捨去)除法 、 %餘數 、 **次方:

https://ithelp.ithome.com.tw/upload/images/20210917/2013059803A9oRtExG.png


上一篇
Day-2 Python 型態、值、變數與名稱
下一篇
Day4- 整數與變數 和 型態轉換
系列文
Python 基礎學習之旅12
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言