Skip to content

Commit

Permalink
Solution2
Browse files Browse the repository at this point in the history
  • Loading branch information
vkalinina committed Sep 20, 2024
1 parent 357393f commit 2ceec06
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
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...")
return "<h1>Hello world</h1>"


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...")
return "http://127.0.0.1:8000"


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...")
Expand All @@ -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...")
Expand Down

0 comments on commit 2ceec06

Please sign in to comment.