def is_leap(year):

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

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

You May Also Like

Top 10 Reasons to Study Full Stack Web Development

Top 10 Reasons to Study Full Stack Web Development

Here are my top 10 reasons to study Full Stack Web Development: 1.Web development is an in-demand skill. 2.Work from...

The 10-second Guide to JSLint (Or, What's the Difference Between ' == ' and ' === '?)

The 10-second Guide to JSLint (Or, What's the Difference Between ' == ' and ' === '?)

10-second guide to JSLint No semicolons. Use === instead of == . No ++ or -- . Use /*global*/ to...

Artistic representation for Canva Code: Empowering Non-Technical Users to Create Interactive Digital Experiences

Canva Code: Empowering Non-Technical Users to Create Interactive Digital Experiences

Breaking Down Barriers to Coding Breaking Down Barriers to Coding Canva Code has introduced a new feature that makes coding...

Complete Guide to Java A

Complete Guide to Java A

A: A blog about Java for individuals and companies. We've been working with Java since the first public version was...

Leave a Reply

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