From 2ceec06643ac8e9e767070c2de5ece9dd8e93b88 Mon Sep 17 00:00:00 2001 From: Viktoria Kalinina Date: Fri, 20 Sep 2024 08:01:43 +0200 Subject: [PATCH] Solution2 --- app/main.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/app/main.py b/app/main.py index 9bd17d21..beeb9d19 100644 --- a/app/main.py +++ b/app/main.py @@ -1,19 +1,16 @@ class SoftwareEngineer: - skills = [] - def __init__(self, name: str) -> None: self.name = name + self.skills = [] - @classmethod - def learn_skill(cls, skill: str) -> None: - return cls.skills.append(skill) + def learn_skill(self, skill: str) -> None: + return self.skills.append(skill) class FrontendDeveloper(SoftwareEngineer): - skills = ["JavaScript", "HTML", "CSS"] - def __init__(self, name: str) -> None: super().__init__(name) + self.skills = ["JavaScript", "HTML", "CSS"] def create_awesome_web_page(self) -> str: print(f"{self.name} is creating a webpage...") @@ -21,10 +18,9 @@ def create_awesome_web_page(self) -> str: class BackendDeveloper(SoftwareEngineer): - skills = ["Python", "SQL", "Django"] - def __init__(self, name: str) -> None: super().__init__(name) + self.skills = ["Python", "SQL", "Django"] def create_powerful_api(self) -> str: print(f"{self.name} is creating an API...") @@ -32,10 +28,9 @@ def create_powerful_api(self) -> str: class AndroidDeveloper(SoftwareEngineer): - skills = ["Java", "Android studio"] - def __init__(self, name: str) -> None: super().__init__(name) + self.skills = ["Java", "Android studio"] def create_smooth_mobile_app(self) -> str: print(f"{self.name} is creating a mobile app...") @@ -47,10 +42,13 @@ class FullStackDeveloper( FrontendDeveloper, SoftwareEngineer ): - skills = BackendDeveloper.skills + FrontendDeveloper.skills def __init__(self, name: str) -> None: super().__init__(name) + self.skills = ( + BackendDeveloper(self.name).skills + + FrontendDeveloper(self.name).skills + ) def create_web_application(self) -> None: print(f"{self.name} started creating a web application...")