Python Program to Check Whether a Given Year is a Leap Year. This is a Python Program to check whether a given year is a leap year or not.
Problem Solution
1. Get the value of the year as input
2. Using an if-statement, check whether the year is a leap year or not
3. Print the final result
4. Exit
Source Code
Python Program to Calculate whether the year is a leap year or not in a Given List. The program output is also shown below.
year=int(input("Enter year:")) if(year%4==0 and year%100!=0 or year%400==0): print("The year is a leap year!) else: print("The year isn't a leap year!)
Run time Test
Output-1:
Enter year t:2012The year is a leap year!
Output-2:
Enter year :2010The year isn't a leap year!