Skip to content

Commit

Permalink
Solved task with passed tests for review
Browse files Browse the repository at this point in the history
  • Loading branch information
tkudinov committed Dec 3, 2024
1 parent 8ac761e commit 726ce6b
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
from __future__ import annotations
from math import ceil


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:
weeks = ceil(days / 7)
return weeks

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

0 comments on commit 726ce6b

Please sign in to comment.