OOP – __init__ Method
__init__ is called automatically when an object is created and sets up its initial attributes
What it does: __init__ runs automatically when Dog('Rex') is called. self.name stores the value. Once set in __init__, the attribute is accessible on the object as d.name. Dog('Rex') creates the object and immediately calls __init__ with 'Rex'. Python uses self (not this) — it's the reference to the object being created. Dunder (double-underscore) methods always have two underscores on each side. Parameters after self become the arguments you pass when creating the object. Without __init__ you can still create objects — they just won't have initial attributes. __init__ must take 'self' as its first parameter. Without it, Python passes the instance and causes a TypeError.
Common mistakes: Missing self as the first parameter. Need DOUBLE underscores: __init__ not _init_.
Free printable worksheet with full answer key — or add this module to a journey and assign it to your class.
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
__init__Fill in the Blanks
Spot the Error
Create a free class, add this module to a journey, and track who's stuck.
Create a free teacher account →No credit card. No setup fee. Make a class and invite students in under three minutes.
Practice this topic interactively, track progress, and unlock badges.
Start Learning Free →