博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2021年 人工智能AI重点分析 第四章Python的数据类型之数字类型
阅读量:4144 次
发布时间:2019-05-25

本文共 1356 字,大约阅读时间需要 4 分钟。

一、数据类型中分为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'>

 

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

转载地址:http://bcuti.baihongyu.com/

你可能感兴趣的文章
DeepLearning tutorial(5)CNN卷积神经网络应用于人脸识别(详细流程+代码实现)
查看>>
DeepLearning tutorial(6)易用的深度学习框架Keras简介
查看>>
DeepLearning tutorial(7)深度学习框架Keras的使用-进阶
查看>>
流形学习-高维数据的降维与可视化
查看>>
Python-OpenCV人脸检测(代码)
查看>>
python+opencv之视频人脸识别
查看>>
人脸识别(OpenCV+Python)
查看>>
6个强大的AngularJS扩展应用
查看>>
网站用户登录系统设计——jsGen实现版
查看>>
第三方SDK:讯飞语音听写
查看>>
第三方SDK:JPush SDK Eclipse
查看>>
第三方开源库:imageLoader的使用
查看>>
自定义控件:飞入飞出的效果
查看>>
自定义控件:动态获取控件的高
查看>>
第三方开源库:nineoldandroid:ValueAnimator 动态设置textview的高
查看>>
第三方SDK:百度地图SDK的使用
查看>>
Android studio_迁移Eclipse项目到Android studio
查看>>
JavaScript setTimeout() clearTimeout() 方法
查看>>
CSS border 属性及用border画各种图形
查看>>
转载知乎-前端汇总资源
查看>>