<\/span><\/h2>\n\n\n\nGiven a year, determine whether it is a leap year. If it is a leap year, return the Boolean True, otherwise return False.<\/p>\n\n\n\n
Note that the code stub provided reads from STDIN and passes arguments to the is_leap function. It is only necessary to complete the is_leap function.<\/p>\n\n\n\n
<\/span>Input Format<\/strong><\/span><\/h2>\n\n\n\nRead year<\/em><\/strong>, the year to test.<\/p>\n\n\n\n<\/span>Constraints<\/strong><\/span><\/h2>\n\n\n\n1900 <= year<\/em> <= 10^5<\/strong><\/p>\n\n\n\n<\/span>Output Format<\/strong><\/span><\/h2>\n\n\n\nThe function must return a Boolean value (True\/False). Output is handled by the provided code stub.<\/p>\n\n\n\n
Sample Input 0<\/strong><\/p>\n\n\n\n1990<\/code><\/pre>\n\n\n\nSample Output 0<\/strong><\/p>\n\n\n\nFalse<\/code><\/pre>\n\n\n\nExplanation 0<\/strong><\/p>\n\n\n\n1990 is not a multiple of 4 hence it’s not a leap year.<\/p>\n\n\n\n
<\/span>Solution – Write a Function in Python – Hacker Rank Solution<\/strong><\/span><\/h2>\n\n\n\ndef is_leap(year):\n leap = False\n \n # Write your logic here\n if (year % 400 == 0):\n return True\n if (year % 100 == 0):\n return leap\n if (year % 4 == 0):\n return True\n else:\n return False \n \n return leap\n\nyear = int(input())\nprint(is_leap(year))<\/pre>\n\n\n\n