Define classes with class and create objects with MyClass(). __init__ initialises the object. self refers to the current instance. Instance attributes are unique per object while class attributes are shared.
Object-Oriented Programming
class Animal:
def __init__(self, name, sound):
self.name = name
self.sound = sound
def speak(self):
return f"{self.name} says {self.sound}"
dog = Animal("Rex", "Woof")
print(dog.speak()) # Rex says Woof
print(dog.name) # Rex