Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
JurassicGen committed Nov 29, 2024
1 parent 8ac761e commit 4eb8b5e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
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:
return days // 7 if days % 7 == 0 else days // 7 + 1

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

0 comments on commit 4eb8b5e

Please sign in to comment.