Last active
December 27, 2018 04:00
-
-
Save rdcoder33/d08ef25b706f3042e48cf12044c32072 to your computer and use it in GitHub Desktop.
This file contains 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: | |
sides = 4 | |
all_sides_equal = False | |
opposite_sides_equal = True | |
type = 'rectangle' | |
def area(self): | |
length = int(input('Enter length: ')) | |
width = int(input('Enter width: ')) | |
return length * width | |
class Square(Rectangle): | |
# overriding necessary attributes | |
all_sides_equal = True | |
type = 'square' | |
# overriding area method | |
def area(self): | |
side = int(input('Enter Side: ')) | |
return side ** 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment