File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33# HackerRank Problem
44# https://www.hackerrank.com/challenges/write-a-function/problem
55
6+ # Source: Wikipedia - https://en.wikipedia.org/wiki/Leap_year
7+ # The following pseudocode determines whether a year is a leap year or a common year
8+ # in the Gregorian calendar (and in the proleptic Gregorian calendar before 1582).
9+ # The year variable being tested is the integer representing the number of the year
10+ # in the Gregorian calendar.
611
7- def is_leap (year ):
8- leap = False
12+ # if (year is not divisible by 4) then(it is a common year)
13+ # else if (year is not divisible by 100) then(it is a leap year)
14+ # else if (year is not divisible by 400) then(it is a common year)
15+ # else (it is a leap year)
916
1017
18+ def is_leap (year ):
19+ leap = False
20+ if year % 4 != 0 :
21+ pass
22+ elif year % 100 != 0 :
23+ leap = True
24+ elif year % 400 != 0 :
25+ leap = False
26+ else :
27+ leap = True
28+ print (leap )
1129 return leap
1230
13-
14- year = int (input ())
31+ is_leap (2000 )
You can’t perform that action at this time.
0 commit comments