(Mar-09-2017, 07:07 AM)wavic Wrote: Or put if year % 100 ==0: on topif he puts this on the top then it will not catch years divisible by 400 - this will be false negative!
The code works as expected, but as you mention he needs to catch incorrect user input, but also can have function that checks leap year or not and return True/False respectively. This will allow to reuse this function in the future, instead of
calendar.isleap()
, which is available.