leap = False
A leap year program in python is a program that determines whether a given year is a leap year or not.
A year is a leap year if it is divisible by 4. But, years divisible by 100 are not leap years, unless they are also divisible by 400.
For example:
The years 1700, 1800, and 1900 were not leap years.
But the years 1600 and 2000 were.
import datetime
def is_leap(year):
leap = False
if 1900<= year <= 10**5:
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
leap = True
else:
leap = True
return leap
year = int(input())
Tomy is a contributor at AskMeCode. We are committed to providing well-researched, accurate, and valuable content to our readers.
You May Also Like
5 Reasons to Start Programming in Python
"5 Reasons to Start Programming in Python" by @arvixx. 1. Python is one of the fastest growing languages, with both...
How to use the Seating Chart in a Classroom
You can use the seating chart in a classroom for many reasons. Perhaps you want to keep certain students away...
Java The Definitive Guide
Java: The Definitive Guide: A blog about Java, the basics to advanced concepts. What are the differences between JDK, JRE...
How to Build a Deck for Smooth Surfaces
how to build a deck for smooth surfaces: how to build a deck for smooth surfaces. If you are building...

