From 776dab855598f245d72879930c14f070e8cdd557 Mon Sep 17 00:00:00 2001 From: OlegatorLE Date: Sat, 12 Aug 2023 20:22:05 +0300 Subject: [PATCH 1/3] Solution --- app/main.py | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index fa56336e..382e1a5d 100644 --- a/app/main.py +++ b/app/main.py @@ -1 +1,44 @@ -# 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.extend(["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.extend(["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.extend(["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 create_web_application(self) -> None: + print(f"{self.name} started creating a web application...") + self.create_powerful_api() + self.create_awesome_web_page() From c699d9243846ffb2023536a27bf726a0dd115079 Mon Sep 17 00:00:00 2001 From: OlegatorLE Date: Sun, 13 Aug 2023 22:26:52 +0300 Subject: [PATCH 2/3] changed logic, use learn_skill method for add skills --- app/main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index 382e1a5d..0bc63e4e 100644 --- a/app/main.py +++ b/app/main.py @@ -10,7 +10,8 @@ def learn_skill(self, skill: str) -> None: class FrontendDeveloper(SoftwareEngineer): def __init__(self, name: str) -> None: super().__init__(name) - self.skills.extend(["JavaScript", "HTML", "CSS"]) + for skill in ["JavaScript", "HTML", "CSS"]: + self.learn_skill(skill) def create_awesome_web_page(self) -> str: print(f"{self.name} is creating a webpage...") @@ -20,7 +21,8 @@ def create_awesome_web_page(self) -> str: class BackendDeveloper(SoftwareEngineer): def __init__(self, name: str) -> None: super().__init__(name) - self.skills.extend(["Python", "SQL", "Django"]) + for skill in ["Python", "SQL", "Django"]: + self.learn_skill(skill) def create_powerful_api(self) -> str: print(f"{self.name} is creating an API...") @@ -30,7 +32,8 @@ def create_powerful_api(self) -> str: class AndroidDeveloper(SoftwareEngineer): def __init__(self, name: str) -> None: super().__init__(name) - self.skills.extend(["Java", "Android studio"]) + for skill in ["Java", "Android studio"]: + self.learn_skill(skill) def create_smooth_mobile_app(self) -> str: print(f"{self.name} is creating a mobile app...") From 9f91e9f5a147285c1ca2460e84c96fdd07a501ae Mon Sep 17 00:00:00 2001 From: OlegatorLE Date: Sun, 13 Aug 2023 23:03:18 +0300 Subject: [PATCH 3/3] Added a check for the inclusion of skill in the list --- app/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 0bc63e4e..f81d8a9e 100644 --- a/app/main.py +++ b/app/main.py @@ -4,7 +4,8 @@ def __init__(self, name: str) -> None: self.skills = [] def learn_skill(self, skill: str) -> None: - self.skills.append(skill) + if skill not in self.skills: + self.skills.append(skill) class FrontendDeveloper(SoftwareEngineer):