In this **HackerRank Write a function problem solution** we have given a year, determine whether it is a leap year. If it is a leap year, return the Boolean True, otherwise, return False.

## HackerRank Write a function in python problem solution

def is_leap(year): leap = False # Write your logic here if year%400 == 0: leap = True elif year%100 == 0: leap = False elif year%4 == 0: leap = True return leap year = int(raw_input()) print is_leap(year)

### The solution in Python 3 programming

def is_leap(year): leap = False if year%4 == 0: if year%100 == 0: if year%400 == 0: leap = True else: leap = False else: leap = True else: leap = False return leap

## 0 Comments