-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patho3.py
More file actions
26 lines (26 loc) · 865 Bytes
/
o3.py
File metadata and controls
26 lines (26 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Circle:
pi=3.14
def __init__(self,radius):
self.radius=radius
self.area=Circle.pi * radius * radius
def get_circumfrence(self):
return 2 * Circle.pi *self. radius
circle_1=Circle(3)
print(f"The area of Circumferance :",circle_1.get_circumfrence())
print(f"The area of Circle :",circle_1.area)
class Rectangle:
def __init__(self,length,width):
self.length=length
self.width=width
def get_area(self):
return self.length*self.width
rectangle_1=Rectangle(5,4)
print(f"The area of Rectangle :",rectangle_1.get_area())
class Triangle:
def __init__(self,base,height):
self.base=base
self.height=height
def get_area(self):
return 0.5 * self.base * self.height
triangle_1=Triangle(6,4)
print(f"The area of Triangle :",triangle_1.get_area())