From 8444b7e45eb1e77b0c42feca58e12782ff909db6 Mon Sep 17 00:00:00 2001 From: sand-777 <63496868+sand-777@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:52:25 +0545 Subject: [PATCH] Update 16_class_and_objects.py changed exception type from NameError to AttributeError --- Basics/Exercise/16_class_and_objects/16_class_and_objects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Basics/Exercise/16_class_and_objects/16_class_and_objects.py b/Basics/Exercise/16_class_and_objects/16_class_and_objects.py index 4893cabc..7a061da1 100644 --- a/Basics/Exercise/16_class_and_objects/16_class_and_objects.py +++ b/Basics/Exercise/16_class_and_objects/16_class_and_objects.py @@ -17,11 +17,11 @@ def display(self): # Deleting the object itself try: print(emp.id) -except NameError: +except AttributeError: print("emp.id is not defined") del emp try: emp.display() # it will gives error after deleting emp except NameError: - print("emp is not defined") \ No newline at end of file + print("emp is not defined")