def is_leap(year):

leap = False

import datetime

year = int(input(“Enter a year: “))

if (year % 4) == 0:

if (year % 100) == 0:

if (year % 400) == 0:

print(“{0} is a leap year”.format(year))

else:

print(“{0} is not a leap year”.format(year))

else:

print(“{0} is a leap year”.format(year))

else:

print(“{0} is not a leap year”.format(year))

import time

import datetime

def is_leap(year):

leap = False

if (year % 4) == 0:

if (year % 100) == 0:

if (year % 400) == 0:

leap = True

else:

leap = False

else:

leap = True

return leap

print(“welcome to the year 2000”)

def is_leap(year):

return year % 4 == 0 and (year % 400 == 0 or year % 100 != 0)

year = int(input())

print(is_leap(year))

The leap year program in python is the program which checks whether a given year is the leap year or not.

In this program, we ask the user to input a year and then we use if…else statement to check whether it is a leap year or not. The condition for a leap year is as follows :

The condition for a leap year is as follows :

If the year is divisible by 4 then it is a leap year but if the year is century year like 2000, 1900, 2100 then it must be divisible by 400.

Tomy

Tomy is a contributor at AskMeCode. We are committed to providing well-researched, accurate, and valuable content to our readers.

You May Also Like

whitehat jr fees review

whitehat jr fees review

A lot of people want to know what the whitehat jr fees course is all about. The whitehat jr fees...

Latex basics and Why you should know them ?

Latex basics and Why you should know them ?

Latex code: %&LaTeX \documentclass[11pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage[T1]{fontenc} \usepackage{amsmath, amsthm, amssymb} \author{John Doe} \begin{document} \title{\LaTeX } \maketitle \tableofcontents \section{Introduction to $\LaTeX$...

Artistic representation for Maximizing AI Impact: A Guide for MedTech Companies

Maximizing AI Impact: A Guide for MedTech Companies

Why AI Investments May Fail AI has long been touted as a transformative technology in the healthcare industry, with many...

The best coding bootcamps in your area.

The best coding bootcamps in your area.

The best coding bootcamps in your area. Whether you're interested in becoming a full-stack web developer, or mastering front-end programming,...

Leave a Reply

About | Contact | Privacy Policy | Terms of Service | Disclaimer | Cookie Policy
© 2026 AskMeCode. All rights reserved.