-
-
Save kshirsagarsiddharth/bd4d9f2b7dcf087cc2432747c55a2889 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Rectangle: | |
| def __init__(self,length,width): | |
| self.length = length | |
| self.width = width | |
| def area(self): | |
| return self.length * self.width | |
| def peremeter(self): | |
| return (self.length + self.width) * 2 | |
| class Square(Rectangle): | |
| def __init__(self,length): | |
| super().__init__(length,length) | |
| class Cube(Square): | |
| def surface_area(self): | |
| face_area = super().area() | |
| return face_area * 6 | |
| def volume(self): | |
| face_area = super().area() | |
| return face_area * self.length |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment