py icon indicating copy to clipboard operation
py copied to clipboard

Update 16_class_and_objects.py

Open onlyJAADU opened this issue 2 years ago • 0 comments

In code-1 ,The delete statement in the code deletes the id attribute of the emp object. The next try-except block tries to access the id attribute, which throws an error because it no longer exists. """[code-1]"""

Deleting the property of object

del emp.id

Deleting the object itself

try: print(emp.id) except NameError: print("emp.id is not defined")

onlyJAADU avatar Jan 22 '23 13:01 onlyJAADU