04 数据类型

"""
数值类型(int float bool )
int 和 float可以进行数学计算

加 减  乘  除   幂运算  整除  取余
+  -  *   /     **    //   %
"""
# type(数据)  查看数据的数据类型
# print(type(18))  # int  整数 整型
# print(type(-18))
# print(type(1.8))  # float 小数 浮点数
# print(type(18.0))  # 只要有小数点就是小数

# print(10 + 20)
# print(10 - 20)
# print(10 * 20)
# print(10 / 20)
# print(10 ** 2)  # 10的2次方 10 * 10
# print(10 ** 3)  # 10的3次方 10*10*10
# print(10 // 3)  # 10除3的最大整数值
# print(10 % 3)  # 取最大整数值后留下的余数
# print(10 / 0)  # 0不能作为分母 ZeroDivisionError: division by zero

# print(20 / 10)  # 2.0 出发返回的都是浮点数(小数)


"""
bool 用于判断
True    真,对
False   假,错误
"""
# if 后面的结果必须是真的时候,才会执行里面的代码
# if True:
#     print("对的")  # True是真, 执行打印
#
# if False:
#     print("对的")  # False不是真, 不执行打印

# 可以进行一定的数学计算 True(1)  False(0)
# print(True + False)  # 1 + 0 = 1
# print(True + True)   # 1 + 1 = 2
# print(True / False)  # False=0,不能作为分母


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值