A leap year is a year that is completely divisible by 4 except the century year (a year that ended with 00). A century year is a leap year if it is divisible by 400. Here, a year is provided by the user and we have to check whether the given year is a leap year or not. This problem, we will solve in two ways first by using the calendar module and second by simply checking the leap year condition.
1) By using the calendar module
Before going to solve the problem, initially, we learn a little bit about the calendar module. Calendar module is inbuilt in Python which provides us various functions to solve the problem related to date, month and year.
Program:
Output
2) By simply checking the leap year condition
As we know the condition to check the given year is a leap year or not. So, here we will implement the condition and try to write the Python program.
Program:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer