Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions projects/014-magic-dates/python/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
def is_magic_date(day: int, month: int, year: int) -> bool:
date=day*month
two_digit_year=year%100
if date==two_digit_year:
return True
else:
return False

for year in range(1901,2001):
for month in range(1,13):
if month==4 or month==6 or month==9 or month==11:
for day in range(1,31):
if is_magic_date(day,month,year):
print(f"{day:02}-{month:02}-{year}")
elif month==2:
for day in range(1,29):
if is_magic_date(day,month,year):
print(f"{day:02}-{month:02}-{year}")
else:
for day in range(1,32):
if is_magic_date(day,month,year):
print(f"{day:02}-{month:02}-{year}")