HackerRank- Write a Function in Python


Problem 6:

You are given the year, and you have to write a function to check if the year is leap or not.

  1. def is_leap(year):
  2. if (year % 4) == 0:
  3. if (year % 100) == 0:
  4. if (year % 400) == 0:
  5. return True
  6. else:
  7. return False
  8. else:
  9. return True
  10. else:
  11. return False
  12. return leap
  13. year = int(input())

download android app