Chapter 2: Basic data types

Basic built-in data types

face Josiah Wang

In line with its philosophy of keeping things simple, Python offers a much more stripped down collection of basic data types compared to Java. The following are the main basic Python data types:

  • Numbers: int, float, complex
  • Booleans: bool
  • Strings: str

That’s mainly it! (There’s also a bytes type, but you probably will not be using it much).

Also, a definition: literal is a succinct and ‘direct’ way to write a value, e.g. 558, 2.6, "hello", True.