E-mail : support@tech2now.in

Check if the year is a leap in Python

We can use the following code to check if the year is a leap year or not.

# Check if year Leap
yy = int(input("Please Enter the Year :: "))

if (( yy%400 == 0)or (( yy%4 == 0 ) and ( yy%100 != 0))):
    print("%d is a Leap Year" %yy)
else:
    print("%d is Not the Leap Year" %yy)
Output:
Please Enter the Year :: 2023
2023 is Not the Leap Year

GitHub Repository – https://github.com/dwivedianu01/Python/blob/main/Leap_Year.py