► Python Program to Check Leap Year


Steps followed:
1. get an input year from user 
2. Check if the given year is leap year if((Year % 400 == 0) or  (Year % 100 != 0) and  (Year % 4 == 0))
3. print result


Program

#Python Program to Check Leap Year
   
# Taking an input year from user  
Year = int(input("Enter the number: "))

# Checking if the given year is leap year  
if((Year % 400 == 0) or  
    (Year % 100 != 0) and  
    (Year % 4 == 0)):   
    print("Given Year is a leap Year");  
# Else it is not a leap year  
else:  
    print ("Given Year is not a leap Year")


Output

Enter the number: 2022
Given Year is not a leap Year

 

Enter the number: 2000
Given Year is a leap Year





Also Read: