Skip to content

Commit

Permalink
'Solution'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy527 committed Dec 13, 2024
1 parent 8ac761e commit 08c4531
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
class OnlineCourse:
# write your code here
pass
def __init__(self, name: str, description: str, weeks: int) -> None:
self.name = name
self.description = description
self.weeks = weeks

@staticmethod
def days_to_weeks(days: int) -> int:
our_weeks = days // 7
if days % 7 != 0:
our_weeks += 1
return our_weeks

@classmethod
def from_dict(cls, dict_in: dict) -> "OnlineCourse":
our_online_course = cls(
dict_in["name"],
dict_in["description"],
cls.days_to_weeks(dict_in["days"])
)
return our_online_course

0 comments on commit 08c4531

Please sign in to comment.