← All examples

Leap year

Python Branching

compound condition

Flowchart (ISO 5807)

YesNoStartInput yy % 4 == 0 and (y % 100 != 0 or y % 400 == 0)Return TrueEndReturn FalseEndFigure 1 — is_leap

Source code

def is_leap(y):
    if y % 4 == 0 and (y % 100 != 0 or y % 400 == 0):
        return True
    return False