Python(1) 整型与浮动型
生活随笔
收集整理的這篇文章主要介紹了
Python(1) 整型与浮动型
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
整型與浮動型
整數/浮動數=浮點型
整數/整數 = 浮點型
例如:
>>> type(1/1)
<class 'float'>
>>> type(1/1.0)
<class 'float'>
整數*整數=整數
整數*浮點數 = 浮點數
<class 'float'>
>>> type(1*1)
<class 'int'>
>>> type(1*1.0)
<class 'float'>
整數+-整數=整數
整數+-浮點數 = 浮點數
>>> type(1+1)
<class 'int'>
>>> type(1+1.0)
<class 'float'>
>>> type(1-1)
<class 'int'>
>>> type(1-1.0)
<class 'float'>
轉載于:https://www.cnblogs.com/guangzhou11/p/11529347.html
總結
以上是生活随笔為你收集整理的Python(1) 整型与浮动型的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 文本最多两行展示
- 下一篇: Python (2) 除法