Objects: Real Things in Code! 🗂️
An object groups related information together — like a trading card! One card holds name, age, colour, power — all about one thing!
Group Related Info Together!
Without objects — messy. With objects — clean and organised!
I remember trying to store information about my favourite Pokémon — I made separate variables for name, type, HP, and attack. It was chaos! Then I learned about objects. One object — all the information, neatly grouped together. It changed everything! 🎮
dog_name = "Buddy" dog_breed = "Labrador" dog_age = 3 dog_colour = "Golden" dog_friendly = True5 separate variables — messy!
dog = {
"name": "Buddy",
"breed": "Labrador",
"age": 3,
"colour": "Golden",
"friendly": True
}1 object — neat & clean! 🎉Everything Around You is an Object!
Any real thing with properties can become a code object!
2 Things You Need to Know!
Create it once — access any property anytime!
Create the Object
Use curly braces { } with key: value pairs inside. Each pair is a property of your object!
cat = { "name": "Whiskers", "colour": "Orange", "age": 2, "indoor": True }
Access Properties
Use square brackets [ ] or a dot (.) to get any value from your object anytime!
# Get the cat's name print(cat["name"]) # Output: Whiskers # Change the age cat["age"] = 3 print(cat["age"]) # Output: 3
Interactive Object Builder!
Choose a type, change the properties — watch the card update live!
Pick a type and customise the properties — your card updates instantly!
4 Key Object Superpowers!
Objects can do way more than just store information!
Read a Property
Get any value from the object using its key name in square brackets!
dog[“name”] → “Buddy”Change a Property
Update any value anytime — just assign a new value using the key!
dog[“age”] = 4Add a New Property
Objects can grow! Add a brand new key-value pair anytime you need!
dog[“tricks”] = 5Remove a Property
Use del to remove a property you no longer need from the object!
del dog[“colour”]4 questions · pick an answer to check!
⭐ Remember This!
Objects group related data together in one place
Use curly braces { } to create an object in Python
Each piece of data has a key and a value
Use object[“key”] to read or change any property!
