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())




codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube