Skip to main content

What are data types?

Just like in real life, Python works with different kinds of information. You can’t add someone’s name to their age - they’re different types of data. Python has four main data types you’ll use constantly:
  • Numbers for counting and calculations
  • Text for words and messages
  • True/False for decisions
Each type has its own rules and abilities. Let’s explore them.

The main types

Numbers

Integers and decimals for math

Strings

Text, words, and characters

Booleans

True or False values

Why we need data types

Python needs to know what type of data you’re working with:

Checking types

You can always check what type something is with type():

Start learning

Pick a data type to explore - numbers are a great place to start!

Learn about numbers

Integers and floats