Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
MykolaMazh committed Oct 21, 2023
1 parent 8ac761e commit b7d66d3
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
class OnlineCourse:
# write your code here
pass
from __future__ import annotations


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

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

def __init__(
self,
name: str,
description: str,
weeks: int
) -> None:
self.name = name
self.description = description
self.weeks = weeks

0 comments on commit b7d66d3

Please sign in to comment.