013 数据类型:数字类型

(整型)和(浮点型)统称为数字类型

一、整形(int)

1.1 什么是整形

​ 整形既整数类型,没有小数的整数都是整数类型

1.2 定义方法

age = 18 # 等同于age=int(18)

print(age)
print(type(age))
print(id(age))

输出:

​ 18

​ <class 'int'>

​ 4530100848

1.3 使用方法

​ 加+ 减- 乘* 除/ 求余% 整除// 乘方**、逻辑判断

二、浮点型(float)

2.1 什么是浮点型

​ 浮点型既浮点类型,就是有浮点数(小数)的都是浮点类型

2.2 定义方法

age = 18.0 # 等同于age=float(18)

print(age)
print(type(age))
print(id(age))

输出:

​ 18.0

​ <class 'float'>

​ 4530100808

2.3 使用方法

​ 加+ 减- 乘* 除/ 求余% 整除// 乘方**、逻辑判断

posted @ 2019-07-30 17:24  正在学习的Barry  阅读(259)  评论(0编辑  收藏  举报
-->