About 173,000 results
Open links in new tab
  1. python - How to determine whether a year is a leap year

    Jul 24, 2012 · def is_leap_year(year): """Determine whether a year is a leap year.""" return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) It's similar to the Mark's answer, but short circuits at the first test (note the parenthesis). Alternatively, you can use the standard library's calendar.isleap, which has exactly the same implementation:

  2. Python calendar.isleap() Function - Online Tutorials Library

    Python Calendar isleap() Function - Learn how to use the isleap() function in Python's calendar module to determine if a year is a leap year. Step-by-step examples and explanations.

  3. Python calendar module | isleap() method - GeeksforGeeks

    Oct 22, 2018 · In Python, calendar.isleap() is a function provided in calendar module for simple text calendars. isleap() method is used to get value True if the year is a leap year, otherwise gives False. Syntax: isleap() Parameter: year: Year to be tested leap or not.

  4. Check Leap Year – Python | GeeksforGeeks

    Feb 22, 2025 · calendar module in Python provides the calendar.isleap(y) function which checks if a given year is a leap year. This built-in function simplifies leap year validation with a single call returning True or False.

  5. Determine, count, and list leap years in Python | note.nkmk.me

    Jan 31, 2024 · Determine if a year is a leap year: calendar.isleap() Count leap years in a specified period: calendar.leapdays() List leap years in a specified period; Determine if a datetime or date object is a leap year

  6. Python Calendar isleap Function - Java Guides

    The isleap function in Python's calendar module checks if a given year is a leap year. This function is useful for determining whether a year has an extra day in February, which occurs every four years with some exceptions.

  7. Python Program to Check Leap Year

    Oct 7, 2019 · Leap years play a crucial role in our calendar system, ensuring that our days, months, and years stay in sync. In this comprehensive guide, we will delve into the concept of leap years and explore how to create a Python program to check if a given year is a leap year.

  8. Python calendar.isleap() Examples - ProgramCreek.com

    def getDOB(self): year = self.getyear() month = self.getmonth() if calendar.isleap(year) and month=='February': self.lastday = 29 elif not calendar.isleap(year) and month=='February': self.lastday = 28 elif month in ('January', 'March', 'May', 'July', 'August', 'October', 'December'): self.lastday = 31 elif month in ('April', 'June', 'September ...

  9. Python calendar isleap() Method with Example - Includehelp.com

    Apr 24, 2023 · The calendar.isleap() method is an inbuilt method of the calendar module, it is used to check whether the given year is a leap year or not. It returns true if the given year is a leap year; false , otherwise.

  10. Python Program for calendar isleap() Method with Examples

    calendar.isleap() is a function in Python’s calendar module for creating simple text calendars. The isleap() method produces a result. If the year is a leap year, True; otherwise, False.

Refresh