Skip to content

Commit 658808e

Browse files
committed
Added the code of Gregorian Calendar
1 parent 37e9e08 commit 658808e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Gregorian_Calendar.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# An extra day is added to the calendar almost every four years as February 29, and the day is called a leap day. It corrects the calendar for the fact that our planet takes approximately 365.25 days to orbit the sun. A leap year contains a leap day.
2+
3+
# In the Gregorian calendar, three conditions are used to identify leap years:
4+
5+
# The year can be evenly divided by 4, is a leap year, unless:
6+
# The year can be evenly divided by 100, it is NOT a leap year, unless:
7+
# The year is also evenly divisible by 400. Then it is a leap year.
8+
# This means that in the Gregorian calendar, the years 2000 and 2400 are leap years, while 1800, 1900, 2100, 2200, 2300 and 2500 are NOT leap years.
9+
10+
def is_leap(year):
11+
leap = False
12+
if (year%4 == 0):
13+
leap = True
14+
if (year%100 == 0):
15+
leap = False
16+
if (year%400 == 0):
17+
leap = True
18+
return leap
19+
20+
year = int(input("Enter the year here: "))
21+
print(is_leap(year))
22+
23+
# If the given year is a leap year it outputs True else False

0 commit comments

Comments
 (0)