Write a Python Program to Check Leap Year.

Write a Python Program to Check Leap Year.

Program
def myfun():
    year=int(input("Enter a year: "))
    if(year%400==0)and(year%100==0):
        print("{0} is a leap year".format(year))
    elif(year%4==0 and year%100!=0):
        print("{0} is a leap year".format(year))    
    else:
        print("{0} is not a leap year".format(year))
        
if __name__=="__main__":
    myfun()


Output:

Enter a year: 2014
2014 is not a leap year

Enter a year: 2024
2024 is a leap year



More Questions


64 . Write a Python Program to Check if a Number is Odd or Even.
65 . Write a Python Program to Check Leap Year.
66 . Write a Python Program to Check Prime Number.
67 . Write a Python Program to Print all Prime Numbers in an Interval of 1-10.
68 . Write a Python Program to Find the Factorial of a Number.
69 . Write a Python Program to Display the multiplication Table.
70 . Write a Python Program to Print the Fibonacci sequence.
71 . Write a Python Program to Check Armstrong Number?
72 . Write a Python Program to Find Armstrong Number in an Interval.
73 . Write a Python Program to Find the Sum of Natural Numbers.
74 . Write a Python Program to Find LCM.



For latest job updates join Telegram Channel: https://t.me/sateeshm