{"id":26032,"date":"2021-12-14T08:43:06","date_gmt":"2021-12-14T03:13:06","guid":{"rendered":"https:\/\/python-programs.com\/?p=26032"},"modified":"2021-12-14T08:43:06","modified_gmt":"2021-12-14T03:13:06","slug":"python-program-for-calendar-isleap-method-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-for-calendar-isleap-method-with-examples\/","title":{"rendered":"Python Program for calendar isleap() Method with Examples"},"content":{"rendered":"

Calendar Module:<\/strong><\/p>\n

The calendar module allows you to output calendars like a program and includes extra calendar-related operations. Calendar module functions and classes make use of an idealized calendar, the current Gregorian calendar extended in both directions indefinitely.<\/p>\n

isleap() Method:<\/strong><\/p>\n

calendar.isleap() is a function in Python’s calendar module for creating simple text calendars.<\/p>\n

The isleap() method produces a result. If the year is a leap year, True; otherwise, False.<\/p>\n

A leap year is a year with one extra day added to bring the calendar year in synchronization with the astronomical or seasonal year.<\/p>\n

Syntax:<\/strong><\/p>\n

isleap(year)<\/pre>\n

Parameter Values:\u00a0<\/strong><\/p>\n

year:<\/strong> This is required. It is a number. The Year to check if it’s a leap year or not.<\/p>\n

Return Value:<\/strong><\/p>\n

If the year is a leap year, it returns True. Otherwise, False.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Year = 2012<\/pre>\n

Output:<\/strong><\/p>\n

Checking whether the given year 2012  is a leap or not =  True<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Year = 2017<\/pre>\n

Output:<\/strong><\/p>\n

Checking whether the given year 2017  is a leap or not =  False<\/pre>\n

Program for calendar isleap() Method with Examples in Python<\/h2>\n