fork(1) download
  1. # your code goes here
  2. # 题目4:闰年判断
  3. # 要求:判断输入的年份是否为闰年。
  4. # 闰年规则:能被4整除但不能被100整除,或者能被400整除。
  5. n = int(input('请输入年:'))
  6. if n%4==0 and n%100!=0 or n%400==0:
  7. print ('n'+"年是闰年")
  8. else :
  9. print ('n'+"年不是闰年")
Success #stdin #stdout 0.12s 14156KB
stdin
2022
stdout
请输入年:n年不是闰年