-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6520ac
commit 8682850
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0x01-challenge |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()) |