DEV Community

Cover image for Cool Python Project 3: Next Leap Year
Abhi Develops - SunTech
Abhi Develops - SunTech

Posted on


Cool Python Project 3: Next Leap Year

Hi Everyone! Welcome to Cool Python Projects!
In this post I will be showing you how to make a Leap Year project that tells you when the next leap year will be. Please remember to follow me to stay updated on any new projects.

Python Code:

print("In this app you will know when the next leap year is this year a leap year.")

what_is_leap_year = input("Do you know what a leap year is? a)YES or b)NO? ")

if what_is_leap_year == 'a':


elif what_is_leap_year == 'b':

   print("I will tell you.")

   print("A leap year happens every 4 years when February has 29 days, understand.")


print("Next I will tell you if it is a leap year now.")

what_year = int(input("What year is it? "))

division = (float(what_year/4))

if division.is_integer():

   print('The year {} is a leap year'.format(what_year))


   print("It is not a leap year.")

division_int = int(division)

for x in range(2):

   next_division = division_int + 1

   next_leap_year = next_division * 4

   print('The next leap year will happen in {}'.format(next_leap_year))

   division_int = division_int + 1

print("I hope you liked this calendar game!")
Enter fullscreen mode Exit fullscreen mode

I hope you enjoyed this Python project.

All the projects code in the series

Top comments (0)

50 CLI Tools You Can't Live Without

>> Check out this classic DEV post <<