Skip to content

Commit

Permalink
Done
Browse files Browse the repository at this point in the history
  • Loading branch information
Moonralex committed Oct 23, 2023
1 parent 8ac761e commit f107b8f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
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:
if days % 7 != 0:
return days // 7 + 1
return days / 7

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

0 comments on commit f107b8f

Please sign in to comment.