代码改变世界

002: 基本类型-数值型(int, float)

2015-12-29 19:18  Miles.Yao  阅读(419)  评论(0编辑  收藏  举报

基本类型中数值类型有 int, float, Decimal, Fraction

其中int 和 float 是比较常见的类型, 而Decimal 和 Fraction 不是那么常见, 所以暂时学习int 和 float.

Division (/) always returns a float

To do floor division and get an integer result (discarding any fractional result) you can use the // operator

To calculate the remainder you can use %

With Python, it is possible to use the ** operator to calculate powers

The equal sign (=) is used to assign a value to a variable.

 

运行一些基本的操作惊奇地发现,在python中数据可以很大很大而不会超出范围,对大数的支持是比较好的。