3.1 Data Types

Integers are whole numbers. For example:

  • 2
  • -3
  • 0

Floats are numbers with a decimal point. For example:

  • 1.2
  • -3.0
  • 26/3 (evaluates to 8.666)

Strings are characters enclosed by single ' or double " quotation marks. Any text enclosed by quotes will be treated as a string.

  • "My Grandpa's deck has no pathetic cards"
  • '85.3'

Note the second example – 85.3 is a float; '85.3' is a string.

Booleans have two possible values: True and False. These can also be expressed as 1 (true) or 0 (false).

We can use the type() function to figure out the data type of an object.