diff --git a/0x01-challenge/README.md b/0x01-challenge/README.md new file mode 100644 index 0000000..e5d8fc9 --- /dev/null +++ b/0x01-challenge/README.md @@ -0,0 +1 @@ +0x01-challenge diff --git a/0x01-challenge/square.py b/0x01-challenge/square.py new file mode 100644 index 0000000..f7bbf21 --- /dev/null +++ b/0x01-challenge/square.py @@ -0,0 +1,33 @@ +#!/usr/bin/python3 +""" Module for square class""" + + +class Square(): + """ Square class """ + width = 0 + height = 0 + + def __init__(self, *args, **kwargs): + """ Instantiation of class """ + for key, value in kwargs.items(): + setattr(self, key, value) + + def area_of_my_square(self): + """ Area of the square """ + return self.width * self.height + + def permiter_of_my_square(self): + """ Perimeter of my square """ + return (self.width * 2) + (self.height * 2) + + def __str__(self): + """ Printable representation """ + return "{}/{}".format(self.width, self.height) + + +if __name__ == "__main__": + """ Create a square object """ + s = Square(width=12, height=9) + print(s) + print(s.area_of_my_square()) + print(s.permiter_of_my_square())