fork download
  1. def is_leap_year(year):
  2. if year <= 1582:
  3. return "年份必须大于1582年"
  4. if (year % 400 == 0) or (year % 100 != 0 and year % 4 == 0):
  5. return f"{year}年是闰年"
  6. else:
  7. return f"{year}年不是闰年"
  8.  
  9. year = int(input())
  10. print(is_leap_year(year))
Success #stdin #stdout 0.12s 14084KB
stdin
2020
stdout
2020年是闰年