Thursday 14 July 2016

Python: Check for leap year


‘calendar.isleap(year)’ method returns true if the year is leap year else false.
>>> import calendar
>>> calendar.isleap(2015)
False
>>> calendar.isleap(2016)
True
>>> calendar.isleap(3000)
False


Previous                                                 Next                                                 Home

No comments:

Post a Comment