Skip to content

Commit

Permalink
solution
Browse files Browse the repository at this point in the history
  • Loading branch information
pr-ruslan committed Dec 28, 2024
1 parent 8ac761e commit 9033109
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
import math
from typing import Any

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 math.ceil(days / 7)

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

0 comments on commit 9033109

Please sign in to comment.