Object Types in Python
6 minutes read
Beginner friendly
Includes practice
Meet Python’s Built-in Object Types 🎲📦
Hi there! Every piece of data in Python lives inside an object—think of objects as Lego bricks you snap together to build programs.
Today you’ll meet the most common brick shapes (object types) you’ll use every day.
What Does “Object Type” Mean?
- Object – a chunk of data stored in memory (number, word, list …).
- Type – the label that tells Python how that chunk behaves (can you add it, loop over it, etc.).
Interactive Code EditorExample Code
pythonThis won’t affect your saved progress.
So, age is an object; int (integer) is its type.
Quick Summary
Everything in Python is an object with a specific type
Knowing the type tells you what you can do with the value
Use
type(value)to ask Python directly
Core Simple Types
a. Numbers
Interactive Code EditorExample Code
pythonThis won’t affect your saved progress.
You can add, subtract, multiply—like a calculator.
b. Booleans
Interactive Code EditorExample Code
pythonThis won’t affect your saved progress.
Only two possible values; great for yes/no questions.
c. Text (Strings)
Interactive Code EditorExample Code
pythonThis won’t affect your saved progress.
A string is a series of characters inside quotes.
Collection Types – Holding Multiple Values
a. Lists (changeable)
Interactive Code EditorExample Code
pythonThis won’t affect your saved progress.
b. Tuples (fixed)
Interactive Code EditorExample Code
pythonThis won’t affect your saved progress.
c. Dictionaries (key → value pairs)
Interactive Code EditorExample Code
pythonThis won’t affect your saved progress.
Python also has sets for unique items, but we’ll focus on the big three above.
Mutable vs Immutable (Plain English)
- Mutable = can change inside the same object (
list,dict) - Immutable = frozen; any “change” makes a brand-new object (
int,str,tuple)
Peek Inside with type() and len()
Interactive Code EditorExample Code
pythonThis won’t affect your saved progress.
type() tells what it is, len() (for many collections) tells how big.
Hands-On Practice – Play with Types
Practice Challenge
Add the color "yellow"to the list so that it contains four colors in total. After appending, store the list length in color_list_lengthand print it.
Append the color "yellow" to the list, then print len(colors).
Runtic's Learning Tips
When unsure, print
type(value)—debugging super-power for beginnersConvert values to other types to experiment:
int("8"),str(3.14)Build a mini address book using a dictionary; add, read, and update contacts to cement the idea
Quick Knowledge Check
Quick Practice
3 minutesIdentify the Type!
What type is '42'? (quotes included)
[1, 2, 3] belongs to which type?
Is a tuple mutable or immutable?
- You created and called functions, mastering def, parameters, and return
- You imported modules (math, random) and understood how packages organise reusable code
- You reinforced learning through quizzes, live-code practice, and growth-mindset tips—keep reusing and organising your own code!
AI Tutor
Solve first — tutor's here to guide.
Runtric might be wrong. Think critically.