Skip to content

Instantly share code, notes, and snippets.

@kshirsagarsiddharth
Created August 8, 2020 08:11
Show Gist options
  • Select an option

  • Save kshirsagarsiddharth/bd4d9f2b7dcf087cc2432747c55a2889 to your computer and use it in GitHub Desktop.

Select an option

Save kshirsagarsiddharth/bd4d9f2b7dcf087cc2432747c55a2889 to your computer and use it in GitHub Desktop.
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