This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def days_of_month(m: int, y: int) -> int: | |
""" | |
Return 30 or 31 if it's not February, otherwise 28 or 29 if leap year. | |
""" | |
return 30 + ((m // 8 + m) % 8) % 2 - (((2-(2%m)) * (m - 1))//2) * (m - 1 + (((((y % 4) + 3 ) // 4)) + ((1 - (((y % 100) + 99) // 100)) * (((y % 400) + 399) // 400)))) |