Commit 4dff9579 by ajil.k

updated assignment1

parent eba74e5a
# inherited Exception class # inherited Exception class
class TestException(Exception): class TestException(Exception):
pass pass
class Circle: class Circle:
def __init__(self, radius): def __init__(self, radius):
self.radius = radius self.radius = radius
...@@ -13,6 +15,7 @@ class Circle: ...@@ -13,6 +15,7 @@ class Circle:
print("\nException Occurred\n") print("\nException Occurred\n")
finally: finally:
print("---------------------------") print("---------------------------")
def perimeter_circle(self): def perimeter_circle(self):
try: try:
perimeter = 2 * 3.14 * self.radius perimeter = 2 * 3.14 * self.radius
...@@ -20,4 +23,4 @@ class Circle: ...@@ -20,4 +23,4 @@ class Circle:
except TestException: except TestException:
print("\nException Occurred\n") print("\nException Occurred\n")
finally: finally:
print("---------------------------") print("---------------------------")
\ No newline at end of file
...@@ -21,4 +21,4 @@ class Square: ...@@ -21,4 +21,4 @@ class Square:
except TestException: except TestException:
print("\nException Occurred\n") print("\nException Occurred\n")
finally: finally:
print("---------------------------") print("---------------------------")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment