LearnPy Hub
← Inheritance & Special Methods problems
Hard

Alternative Constructor

Write Date(day, month, year) with a @classmethod from_string(s) that parses DD/MM/YYYY, a @staticmethod is_leap(year), and __str__ giving YYYY-MM-DD. Print the date and whether its year is a leap year.

Input

One date DD/MM/YYYY.

Output

Two lines.

Sample 1

Input
28/10/2026
Output
2026-10-28
False

Sample 2

Input
29/02/2024
Output
2024-02-29
True
solution.py
Output appears here
Alternative Constructor · Python practice problem · LearnPy Hub