Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Last active May 26, 2021 04:02
Show Gist options
  • Save Abhayparashar31/50dde0f0210e8819d7eca251398a8d34 to your computer and use it in GitHub Desktop.
Save Abhayparashar31/50dde0f0210e8819d7eca251398a8d34 to your computer and use it in GitHub Desktop.
class Rectangle:
def __init__(self, l, b):
self.l = l
self.b = b
def area(self):
return self.l * self.b
class Square:
def __init__(self, side):
self.s = side
def area(self):
return self.s ** 2
rec = Rectangle(10, 20)
squ = Square(10)
for data in (rec, squ):
print(data.area())
-----------------------------OUTPUT----------------------------
200
100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment