Last active
May 26, 2021 04:02
-
-
Save Abhayparashar31/50dde0f0210e8819d7eca251398a8d34 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, 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