-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9-rectangle.py
More file actions
33 lines (28 loc) · 889 Bytes
/
9-rectangle.py
File metadata and controls
33 lines (28 loc) · 889 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
#!/usr/bin/python3
"""
BaseGeometry module
"""
BaseGeometry = __import__('7-base_geometry').BaseGeometry
class Rectangle(BaseGeometry):
""" Class Rectangle """
def __init__(self, width, height):
""" Instantiation with width and height
Arguments:
@width: size
@height: size
"""
self.integer_validator("width", width)
self.integer_validator("height", height)
self.__width = width
self.__height = height
""" Implementation of area """
def area(self):
""" Function that calculates the area of the rectangle
Return:
The area of the rectangle
"""
return (self.__width * self.__height)
""" Implementation of str """
def __str__(self):
""" Returns the message to print """
return ("[Rectangle] {:}/{:}".format(self.__width, self.__height))