Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions python/src/cat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class Cat:
def __init__(self, age, name, color):
if age >= 19:
raise ValueError("This age is not correctly specified")
self.age = age
self.name = name
self.color = color

def set_age(self, age):
if age >= 19:
raise ValueError("This age is not correctly specified")
else:
self.age = age

def set_name(self, name):
self.name = name

def get_age(self):
return self.age

def get_name(self):
return self.name

def get_color(self):
return self.color
16 changes: 12 additions & 4 deletions python/src/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
def summ(a: int, b: int) -> int:
return a + b
from cat import Cat


if __name__ == "__main__":
print("Hello world")
print(summ(3, 4))
print('lab 5(python)')
cat = Cat(3, "Jack", "black and white")
cat.set_age(5)
cat.set_name("Tom")
cat2 = Cat(5, "Tom", "white")

print(f"Возраст кота - {cat.get_age()}")
print(f"Его имя - {cat.get_name()}")
print(f"Его цвет - {cat.get_color()}")