From 357393f15dde55dbfccea4277c379ede06d5a5ac Mon Sep 17 00:00:00 2001 From: Viktoria Kalinina Date: Thu, 19 Sep 2024 22:08:38 +0200 Subject: [PATCH 1/6] Solution --- app/main.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index fa56336e..9bd17d21 100644 --- a/app/main.py +++ b/app/main.py @@ -1 +1,58 @@ -# write your code here +class SoftwareEngineer: + skills = [] + + def __init__(self, name: str) -> None: + self.name = name + + @classmethod + def learn_skill(cls, skill: str) -> None: + return cls.skills.append(skill) + + +class FrontendDeveloper(SoftwareEngineer): + skills = ["JavaScript", "HTML", "CSS"] + + def __init__(self, name: str) -> None: + super().__init__(name) + + def create_awesome_web_page(self) -> str: + print(f"{self.name} is creating a webpage...") + return "

Hello world

" + + +class BackendDeveloper(SoftwareEngineer): + skills = ["Python", "SQL", "Django"] + + def __init__(self, name: str) -> None: + super().__init__(name) + + def create_powerful_api(self) -> str: + print(f"{self.name} is creating an API...") + return "http://127.0.0.1:8000" + + +class AndroidDeveloper(SoftwareEngineer): + skills = ["Java", "Android studio"] + + def __init__(self, name: str) -> None: + super().__init__(name) + + def create_smooth_mobile_app(self) -> str: + print(f"{self.name} is creating a mobile app...") + return "Ads every three swipes" + + +class FullStackDeveloper( + BackendDeveloper, + FrontendDeveloper, + SoftwareEngineer +): + skills = BackendDeveloper.skills + FrontendDeveloper.skills + + def __init__(self, name: str) -> None: + super().__init__(name) + + 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 2ceec06643ac8e9e767070c2de5ece9dd8e93b88 Mon Sep 17 00:00:00 2001 From: Viktoria Kalinina Date: Fri, 20 Sep 2024 08:01:43 +0200 Subject: [PATCH 2/6] 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...") From cd227ad9dde0023488d61326780876932647a48d Mon Sep 17 00:00:00 2001 From: Viktoria Kalinina Date: Fri, 20 Sep 2024 09:19:06 +0200 Subject: [PATCH 3/6] Solution3 --- app/main.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index beeb9d19..d619c2ae 100644 --- a/app/main.py +++ b/app/main.py @@ -45,10 +45,7 @@ class FullStackDeveloper( def __init__(self, name: str) -> None: super().__init__(name) - self.skills = ( - BackendDeveloper(self.name).skills - + FrontendDeveloper(self.name).skills - ) + self.skills += ["JavaScript", "HTML", "CSS"] def create_web_application(self) -> None: print(f"{self.name} started creating a web application...") From 261db20eb977bf3f2a531d967cfecaf981b78105 Mon Sep 17 00:00:00 2001 From: Viktoria Kalinina Date: Sat, 21 Sep 2024 07:09:30 +0200 Subject: [PATCH 4/6] Solution4 --- app/main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index d619c2ae..ba3f29f0 100644 --- a/app/main.py +++ b/app/main.py @@ -10,7 +10,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 += ["JavaScript", "HTML", "CSS"] def create_awesome_web_page(self) -> str: print(f"{self.name} is creating a webpage...") @@ -20,7 +20,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 += ["Python", "SQL", "Django"] def create_powerful_api(self) -> str: print(f"{self.name} is creating an API...") @@ -30,7 +30,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 += ["Java", "Android studio"] def create_smooth_mobile_app(self) -> str: print(f"{self.name} is creating a mobile app...") @@ -45,9 +45,12 @@ class FullStackDeveloper( def __init__(self, name: str) -> None: super().__init__(name) - self.skills += ["JavaScript", "HTML", "CSS"] def create_web_application(self) -> None: print(f"{self.name} started creating a web application...") self.create_powerful_api() self.create_awesome_web_page() + + +ben = FullStackDeveloper("Ben") +print(ben.skills) From 99a3fa32226e935feace12e1e9681e529e34b205 Mon Sep 17 00:00:00 2001 From: Viktoria Kalinina Date: Sun, 22 Sep 2024 07:50:07 +0200 Subject: [PATCH 5/6] Solution5 --- app/main.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/main.py b/app/main.py index ba3f29f0..78d890c0 100644 --- a/app/main.py +++ b/app/main.py @@ -50,7 +50,3 @@ def create_web_application(self) -> None: print(f"{self.name} started creating a web application...") self.create_powerful_api() self.create_awesome_web_page() - - -ben = FullStackDeveloper("Ben") -print(ben.skills) From 41f68ed48ac91f1aad035684ec39b4f8fbdcb432 Mon Sep 17 00:00:00 2001 From: Viktoria Kalinina Date: Sun, 22 Sep 2024 07:54:07 +0200 Subject: [PATCH 6/6] Solution6 --- app/main.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/main.py b/app/main.py index 78d890c0..4796192e 100644 --- a/app/main.py +++ b/app/main.py @@ -43,9 +43,6 @@ class FullStackDeveloper( SoftwareEngineer ): - def __init__(self, name: str) -> None: - super().__init__(name) - def create_web_application(self) -> None: print(f"{self.name} started creating a web application...") self.create_powerful_api()