Write a function - HackerRank Problem Solution

Write a function - HackerRank Problem Solution

Instructor-svgAl-Mamun Sarkar
Mar 23 , 2020

Solutions of Write a function - HackerRank Problem

Code:

def is_leap(year):
    leap = False

    if year % 4 == 0:
        leap = True
        if year % 100 == 0:
            if year % 400 == 0:
                leap = True
            else:
                leap = False
    else:
        leap = False

    return leap

Test Input:

1990

Test Output:

False

Explanation:

1990 is not a leap year because it's not a multiple of 4

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram