Skip to content

Commit

Permalink
Task 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronnie5562 committed Jul 22, 2023
1 parent eaa3196 commit c89161a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions python-classes/2-square.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/python3
"""Define a class Square."""


class Square:
"""A class that defines a square"""

def __init__(self, size=0):
"""Initialize a new Square.
Args:
size (int): The size of the square.
"""
if not isinstance(size, int):
raise TypeError("size must be an integer")
elif size < 0:
raise ValueError("size must be >= 0")
self.__size = size

0 comments on commit c89161a

Please sign in to comment.