-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10.py
More file actions
42 lines (35 loc) · 952 Bytes
/
Copy path10.py
File metadata and controls
42 lines (35 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import abc
class Shape(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def calc_perimeter(self, input):
"""Method documentation"""
return
class Triangle(Shape):
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def calc_perimeter(self):
perim = self.a + self.b + self.c
print("Consider me implemented", perim)
return perim
class Rectangle(Shape):
def __init__(self, a, b):
self.a = a
self.b = b
def calc_perimeter(self):
perim = self.a + self.b
print("Consider me implemented", perim)
return perim
class Square(Rectangle):
def __init__(self, a, b=None):
super().__init__(a, b=None)
self.a = a
if b is None:
return a
my_rectangle = Rectangle(10,5)
my_rectangle.calc_perimeter()
my_square = Square(10)
#my_square.a = Square(10)
my_square.calc_perimeter()