Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
mishasanin committed Sep 3, 2023
1 parent 8ac761e commit d984520
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
class OnlineCourse:
# write your code here
pass
def __init__(self, name, description, weeks):
self.name = name
self.description = description
self.weeks = weeks

@staticmethod
def days_to_weeks(days):
return (days + 6) // 7

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

0 comments on commit d984520

Please sign in to comment.