Commit c6914ce5 by arjun.b

Assignment 1

parent ea54cc90
......@@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
......@@ -6,7 +6,7 @@ length = float(input("enter the length of the rectangle"))
width = float(input("enter the width of the rectangle"))
obj_rect = Rect(length, width) # create the object of the class Rect
print("area of rectangle=",obj_rect.area())
print("perimeter of rectangle=",obj_rect.perimetr)
print("perimeter of rectangle=",obj_rect.perimetr())
# initializing the radius of the circle
radius = float(input("enter the radius"))
obj_cir = Circle(radius) # create the object of the class Circle
......
class myException(Exception):
class MyException(Exception):
pass
......@@ -10,13 +10,12 @@ class Rect:
def area(self):
try:
return self.length * self.width
except myException:
except MyException:
print("exception occurred")
def perimetr(self):
try:
return 2 * (self.length + self.width)
except myException:
c = self.length * 2 + self.width * 2
return c
except MyException:
print("exception occurred")
finally:
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