日历要知道二月有几天。闰年的规则:能被 4 整除,但不能被 100 整除;或者能被 400 整除。写 is_leap(year),是闰年返回 True。
is_leap(2024)→Trueis_leap(2023)→Falseis_leap(1900)→Falsedef is_leap(year):
by4 = year % 4 == 0
by100 = year % 100 == 0
by400 = year % 400 == 0
# 在这里写:用 and / or / not 把三个条件组合起来
pass
写好了先点「运行」试试示例,没问题再点「提交」。