小强森 发表于 2018-2-9 17:16:03

新手自觉python找题练习(4)

#【程序4】题目:输入某年某月某日,判断这一天是这一年的第几天?





#答案——————————————————————————————————————————
year1=int(input('输入年份:'))
month1=int(input ('输入月份:'))
day1=int(input('输入天:'))
months=
if 0<=month1<=12:
      num=months
else:
      print('月份不正确')
num+=day1
rn=0
if (year1%400==0) or ((year1%4==0) and (year1%100!=0)):
      rn=1
if(rn==0) and (month1>2):
      num+=1
print ('这是一年中的第:%s 天'%(num))
页: [1]
查看完整版本: 新手自觉python找题练习(4)