Python Class Properties 🏷️
Modifying Object Properties
You can modify properties on objects like this:
✨ Modify Properties
python
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
p1 = Person("John", 36)
p1.age = 40
print(p1.age)🗑️ Delete Object Properties
You can delete properties on objects by using the del keyword:
python
del p1.age❌ Delete Objects
You can delete objects by using the del keyword:
python
del p1⚠️ Watch Out!
If you try to access a deleted property or object, Python will raise an error (AttributeError or NameError).