Python to check whether the year is leap or not
Python to check whether the year is leap or not
In this, you will learn how to check whether the year is leap or not in Python Programming.
Leap year - If it contains an additional day which makes number of days in a year in 366 then this year is called leap year.
Example:
2017 is not a leap year
1900 was not a leap year
2020 is a leap year
2000 is a leap year
1992 was a leap year
Python Code:
y = int(input('enter any year:'))
if (y%4==0 and y%100!=0 or y%400==0):
print('entered year is leap')
else:
print('entered year is not leap')
Output:
Case 1: enter any year: 2020
entered year is leap
Case 2: enter any year: 2019
entered year is not leap
Recommended Post:Program to check whether the number is prime
Plotting of even, odd, prime numbers
Subplot of even, odd and prime numbers from a list
Python Program to print Arithmetic Progress series
Program to find even and odd numbers from the list
Program to check whether a number is odd or even in Python