Site icon

Leap Year in Python

Write a Program in Python to check if a Year is Leap Year or not.

#Starting  with a Default function to implement conditions to find a leap year  
def CheckLeap(Year):  
  # This part will check that the given year is leap year  
  if((Year % 400 == 0) or  
     (Year % 100 != 0) and  
     (Year % 4 ==  0)):   
    print("Congratulations! Given Year is a leap Year");  
  # Else it is not a leap year  
     print ("Sorry! Given Year is not a leap Year")  
# Getting an input year from user  
Year = int(input("Please Enter the number: "))  
# Display the result  


Please Enter the number: 234
Sorry! Given Year is not a leap Year

Exit mobile version