Data Types · Lesson 28 of 76
Data types
Every value in Python has a type. The everyday ones:
int— whole numbers, like42float— decimals, like7.5str— text, like"Lagos"bool—TrueorFalselist— 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 →