The Python Apprentice
上QQ阅读APP看书,第一时间看更新

Scalar data types: integers, floats, None and bool

Python comes with a number of built-in datatypes. These include primitive scalar types like integers as well as collection types like dictionaries. These built-in types are powerful enough to be used alone for many programming needs, and they can be used as building blocks for creating more complex data types.

The basic built-in scalar types we'll look at are:

  • int — signed, unlimited precision integers
  • float — IEEE 754 floating-point numbers
  • None — a special, singular null value
  • booltrue/false boolean values

For now we'll just be looking at their basic details, showing their literal forms and how to create them.