Write a function Hacker Rank Solution – Queslers

Problem: Write a function Hacker Rank Solution

We add a Leap Day on February 29, almost every four years. The leap day is an extra, or intercalary, day and we add it to the shortest month of the year, February. 
In the Gregorian calendar three criteria must be taken into account to identify leap years:

  • The year can be evenly divided by 4;
  • If the year can be evenly divided by 100, it is NOT a leap year, unless;
  • The year is also evenly divisible by 400. Then it is a leap year.

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.SourceTask
You are given the year, and you have to write a function to check if the year is leap or not.Note that you have to complete the function and remaining code is given as template.Input FormatRead y, the year that needs to be checked.ConstraintsOutput FormatOutput is taken care of by the template. Your function must return a boolean value (True/False)Sample Input


Sample Output


Explanation1990 is not a multiple of 4 hence it’s not a leap year.

Write a function Hacker Rank Solution

def is_leap(year):
    leap = False
    # Write your logic here
    if year%4==0:
        if year%100==0:
            if year%400==0:

    return leap

year = int(input())
Write a function Hacker Rank Solution Review:

In our experience, we suggest you solve this Write a function Hacker Rank Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

Write a function problem is available on Hacker Rank for Free, if you are stuck anywhere between a compilation, just visit Queslers to get Write a function Hacker Rank Solution


I hope this Write a function Hacker Rank Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning Programming in a business context; there are no prerequisites.

Keep Learning!

More Hacker Rank Problem & Solutions >>

Staircase Hacker Rank Solution

A Very Big Sum Hacker Rank Solution

Diagonal Difference Hacker Rank Solution

Nested Lists Hacker Rank Solution

Lists Hacker Rank Solution

Leave a Reply

Your email address will not be published.