Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

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? ")ifwhat_is_leap_year=='a':print("Awesome!")elifwhat_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))ifdivision.is_integer():print('The year {} is a leap year'.format(what_year))else:print("It is not a leap year.")division_int=int(division)forxinrange(2):next_division=division_int+1next_leap_year=next_division*4print('The next leap year will happen in {}'.format(next_leap_year))division_int=division_int+1print("I hope you liked this calendar game!")
Enter fullscreen modeExit fullscreen mode

I hope you enjoyed this Python project.

All the projects code in the series

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Hi, I am Abhinav Gupta. I am a self-taught web developer and I know mainly HTML, CSS, some Javascript and Python.
  • Education
    Riverbank Public School Australia
  • Work
    I am the Founder of SunTech where people can hire me to create an awesome looking website for them.
  • Joined

More fromAbhi Develops - SunTech

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp