Репозиторий с шуточным резюме на питоне.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from datetime import date,datetime
|
|
|
|
from enum import Enum
|
|
|
|
|
|
|
|
|
|
|
|
class Sex(Enum):
|
|
|
|
MALE="Мужчина",
|
|
|
|
FEMALE="Женщина"
|
|
|
|
|
|
|
|
def __repr__(self) -> str:
|
|
|
|
return f"{self.value}"
|
|
|
|
|
|
|
|
class AbstractHuman:
|
|
|
|
def __init__(self,first_name:str,last_name:str,sex:Sex,birthday:str) -> None:
|
|
|
|
self.first_name=first_name
|
|
|
|
self.last_name=last_name
|
|
|
|
self.sex=sex
|
|
|
|
self.birthday=datetime.strptime(birthday, "%d-%m-%Y").date()
|
|
|
|
|
|
|
|
@property
|
|
|
|
def age(self) -> int:
|
|
|
|
today=datetime.now()
|
|
|
|
age=today.year-self.birthday.year -((today.month, today.day) < (self.birthday.month, self.birthday.day))
|
|
|
|
if age>0:
|
|
|
|
return int(age)
|
|
|
|
else:
|
|
|
|
raise "Мамочка! Меня еще не родили"
|
|
|
|
|
|
|
|
|
|
|
|
def _eat(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def _sleep(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def _play(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def say(self,speach: str) -> None:
|
|
|
|
print(f"{self.first_name} {self.last_name}: {speach}")
|
|
|
|
|
|
|
|
def about(self):
|
|
|
|
return f"{self.first_name} {self.last_name}. {repr(self.sex)} {self.birthday} ({self.age} полных лет)"
|