- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Check Leap Year using Python?
Leap year comes after every four years. For normal year, if it is divisible by four, it is called leap year, whereas for century year, it should be divisible by 400. The following Python program shows whether the year is leap or not
Example
yr=int(input('enter year')) if yr%100==0: #century year if yr%400==0: print ('{} is leap year'.format(yr)) else: print ('{} is not leap year'.format(yr)) else: if yr%4==0: print ('{} is leap year'.format(yr)) else: print ('{} is not leap year'.format(yr))
Output
enter year2012 2012 is leap year enter year2018 2018 is not leap year 2000 is leap year enter year1900 1900 is not leap year
- Related Articles
- C++ Program to Check Leap Year
- Java Program to Check Leap Year
- JavaScript program to check if a given year is leap year
- How to find a leap year using C language?
- Python Pandas - Check whether the year is a leap year from the Period object
- Program to check if a given year is leap year in C
- PHP program to check if a year is leap year or not
- Golang Program to Check Whether a Given Year is a Leap Year
- How to find leap year or not in android using year API class?
- Check if a given year is leap year in PL/SQL
- How to check whether a year or a vector of years is leap year or not in R?
- How to check Leap Year in Java 8 How to get current timestamp in Java 8?
- Checking for a Leap Year using GregorianCalendar in Java
- How to detect if a given year is a Leap year in Oracle?
- Finding nth day of the year in leap and non-leap years in JavaScript

Advertisements