← Courses

Python for AI — Beginner Foundations

Data Science

Data Types · Lesson 28 of 76

Data types

Every value in Python has a type. The everyday ones:

  • int — whole numbers, like 42
  • float — decimals, like 7.5
  • str — text, like "Lagos"
  • boolTrue or False
  • list — an ordered collection, like [1, 2, 3]
  • dict — key→value pairs, like {"name": "Ada"}

Ask Python a value's type with type():

Python

Knowing the type matters because it decides what you can do — you can add numbers, join strings, and loop over lists.

Your turn: print the type of {"city": "Kano"}.

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →