Python program to check whether a given year is a leap
kw.py
print("__________________________________________")print("Program to check the given year is leap or not")print("__________________________________________")try:y=input("Enter the year ")if(len(y)!=4orint(y)<=0):print("Enter a valid year")else:year=int(y)if(year%4==0):if(year%100==0):if(year%400==0):print("{0} is a leap year".format(year))else:print("{0} is not a leap year".format(year))else:print("{0} is a leap year".format(year))else:print("{0} is not a leap year".format(year))exceptValueError:print("Enter valid year")print("__________________________________________")
Output
kodingwindow@kw:~$ python3 kw.py
__________________________________________
Program to check the given year is leap or not
__________________________________________
Enter the year 65535
Enter a valid year
__________________________________________
kodingwindow@kw:~$ python3 kw.py
__________________________________________
Program to check the given year is leap or not
__________________________________________
Enter the year 2024
2024 is a leap year
__________________________________________
Dear User, Thank you for visitng Kodingwindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.
Dear User, We are grateful for your interest in the Kodingwindow Android app. We intend to soon make it available on the Google Play Store. Currently, Android versions 10 and up require manual apk installations. Would you like to get the app?