• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
机灵小不懂
博客园    首页    新随笔    联系   管理    订阅  订阅

Python - 1. Built-in Atomic Data Types

From:http://interactivepython.org/courselib/static/pythonds/Introduction/GettingStartedwithData.html

  1. numeric classes 

Python has two main built-in numeric classes that implement the integer and floating point data types.Note that when two integers are divided, the result is a floating point.

  2. The boolean data type

>>> True
True
>>> False
False
>>> False or True
True
>>> not (False or True)
False
>>> True and True
True

In addition, relational operators and logical operators can be combined together to form complex logical questions.

Operation NameOperatorExplanation
less than < < Less than operator
greater than > > Greater than operator
less than or equal <= <= Less than or equal to operator
greater than or equal >= >= Greater than or equal to operator
equal == == Equality operator
not equal != != Not equal operator
logical and and and Both operands True for result to be True
logical or or or One or the other operand is True for the result to be True
logical not not not Negates the truth value, False becomes True, True becomes False

  3. Identifiers

>>> theSum = 0
>>> theSum
0
>>> theSum = theSum + 1
>>> theSum
1
>>> theSum = True
>>> theSum
True
../_images/assignment1.png
../_images/assignment2.png
 
 
posted @ 2017-11-22 10:46  机灵小不懂  阅读(428)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3