forked from fenyx-it-academy/Class6-Python-Module-Week5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeek_5_Question_2.py
More file actions
36 lines (26 loc) · 878 Bytes
/
Copy pathWeek_5_Question_2.py
File metadata and controls
36 lines (26 loc) · 878 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
27
28
29
30
31
32
#!/usr/bin/env python
# coding: utf-8
# In[7]:
class Rectangle:
def __init__(self, length, width):
self.length = length
self.width = width
def area(self):
self.area=self.length * self.width
return self.area
def perimeter(self):
self.perimeter=2 * self.length + 2 * self.width
return self.perimeter
def display(self):
print("length :{}, width: {}, area :{} and perimeter:{}".format(self.length,self.width,self.area,self.perimeter))
class Parallelepipede(Rectangle):
def __init__(self,length,width,height):
super().__init__(length, width)
#super()=Rectangle
self.height=height
def volume(self):
self.volume=self.length * self.width * self.height
return self.volume
def display(self):
print("volume: {}".format(self.volume))
# In[ ]: