diff --git a/square.py b/square.py index 6d05328..32f6d98 100755 --- a/square.py +++ b/square.py @@ -1,28 +1,23 @@ -#!/usr/bin/python3 - -class square(): - - width = 0 - height = 0 - +class Square: - def __init__(self, *args, **kwargs): - for key, value in kwargs.items(): - setattr(self, key, value) + def __init__(self, width=0, height=0): + self.width = width + self.height = height def area_of_my_square(self): """ Area of the square """ return self.width * self.width - def PermiterOfMySquare(self): - return (self.width * 2) + (self.height * 2) + def perimeter_of_my_square(self): + """ Perimeter of the square """ + return self.width * 4 def __str__(self): return "{}/{}".format(self.width, self.height) if __name__ == "__main__": - s = square(width=12, height=9) + s = Square(width=12, height=9) print(s) print(s.area_of_my_square()) - print(s.PermiterOfMySquare()) + print(s.perimeter_of_my_square())