Cool Python Project 3: Next Leap Year
Abhi Develops - SunTech
Posted on December 7, 2021
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':
print("Awesome!")
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()
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))
else:
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!")
I hope you enjoyed this Python project.
💖 💪 🙅 🚩
Abhi Develops - SunTech
Posted on December 7, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.