From f3b89c10419939ecc78aff16b489160e833578e0 Mon Sep 17 00:00:00 2001 From: Lora Evseenko Date: Mon, 7 Oct 2024 16:00:59 +0300 Subject: [PATCH 1/2] 'Solution' --- app/main.py | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index fa56336e..7e4206c0 100644 --- a/app/main.py +++ b/app/main.py @@ -1 +1,49 @@ -# write your code here +class SoftwareEngineer: + def __init__(self, name: str) -> None: + self.name = name + + self.skills = [] + + def learn_skill(self, skill: str) -> None: + self.skills.append(skill) + + +class FrontendDeveloper(SoftwareEngineer): + 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...") + return "

Hello world

" + + +class BackendDeveloper(SoftwareEngineer): + 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...") + return "http://127.0.0.1:8000" + + +class AndroidDeveloper(SoftwareEngineer): + 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...") + return "Ads every three swipes" + + +class FullStackDeveloper(FrontendDeveloper, BackendDeveloper): + def __init__(self, name: str) -> None: + super().__init__(name) + self.skills = list(set(self.skills + BackendDeveloper(name).skills)) + + def create_web_application(self) -> None: + print(f"{self.name} started creating a web application...") + self.create_powerful_api() + self.create_awesome_web_page() From 46c81734fd296070cc13a2eb8eb47a5fa4d74087 Mon Sep 17 00:00:00 2001 From: Lora Evseenko Date: Tue, 8 Oct 2024 12:34:33 +0300 Subject: [PATCH 2/2] 'Solution' --- app/main.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/main.py b/app/main.py index 7e4206c0..c67c4af3 100644 --- a/app/main.py +++ b/app/main.py @@ -11,7 +11,7 @@ def learn_skill(self, skill: str) -> None: class FrontendDeveloper(SoftwareEngineer): def __init__(self, name: str) -> None: super().__init__(name) - self.skills = ["JavaScript", "HTML", "CSS"] + self.skills.extend(["JavaScript", "HTML", "CSS"]) def create_awesome_web_page(self) -> str: print(f"{self.name} is creating a webpage...") @@ -21,7 +21,7 @@ def create_awesome_web_page(self) -> str: class BackendDeveloper(SoftwareEngineer): def __init__(self, name: str) -> None: super().__init__(name) - self.skills = ["Python", "SQL", "Django"] + self.skills.extend(["Python", "SQL", "Django"]) def create_powerful_api(self) -> str: print(f"{self.name} is creating an API...") @@ -31,7 +31,7 @@ def create_powerful_api(self) -> str: class AndroidDeveloper(SoftwareEngineer): def __init__(self, name: str) -> None: super().__init__(name) - self.skills = ["Java", "Android studio"] + self.skills.extend(["Java", "Android studio"]) def create_smooth_mobile_app(self) -> str: print(f"{self.name} is creating a mobile app...") @@ -39,10 +39,6 @@ def create_smooth_mobile_app(self) -> str: class FullStackDeveloper(FrontendDeveloper, BackendDeveloper): - def __init__(self, name: str) -> None: - super().__init__(name) - self.skills = list(set(self.skills + BackendDeveloper(name).skills)) - def create_web_application(self) -> None: print(f"{self.name} started creating a web application...") self.create_powerful_api()