def leap_years(x): years = [] for year in range(1, x + 1): if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0): years.append(year) print(years)