2021年 人工智能AI重点分析 第四章Python的数据类型之数字类型

一、数据类型中分为6种如下:

Number、String、List、Tuple、Sets、Dictionary

 

在python安装完后在python解释中输入import this

>>> import this

The Zen of Python, by Tim Peters

 

Beautiful is better than ugly.

Explicit is better than implicit.

Simple is better than complex.

Complex is better than complicated.

Flat is better than nested.

Sparse is better than dense.

Readability counts.

Special cases aren't special enough to break the rules.

Although practicality beats purity.

Errors should never pass silently.

Unless explicitly silenced.

In the face of ambiguity, refuse the temptation to guess.

There should be one-- and preferably only one --obvious way to do it.

Although that way may not be obvious at first unless you're Dutch.

Now is better than never.

Although never is often better than *right* now.

If the implementation is hard to explain, it's a bad idea.

If the implementation is easy to explain, it may be a good idea.

Namespaces are one honking great idea -- let's do more of those!

 

注意1:这是作者设计的说明。

注意2:任何语言都会对数据做一些划分,为什么要划分呢?它是为了方便管理和方便 使用,跟生活中一样,在生活中划分了很多类。

 

  • Number(数字)

Python3支持int、float、bool、complex(复数)

 

Int类型是代表着整数,这个范围是无限小~无限大(注意:是根据计算机限制而定)。

Float类型是代表着小数,如:1.23等。例子如下:

a = 3.14e-10

print(a)

 

bool类型是用来判断使用,表示真和假,例子如下:

a = False

b = True

print(a+b)

 

complex类型是代表着复数,例子如下

c = 3+4j

print(c)

 

其他如何查看数据类型使用type函数如下

c = 4j

print(type(c))

<class 'complex'>

 

注意:复数的意思如:一个实数+负数 = 复数。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

随行之旅

python国产化自动化

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值