标签:入门 简单 计算
Python新人代码如下:year = int(input(‘请输入年份:‘))
momth = int(input(‘请输入月份:‘))
day = int(input(‘请输入几号‘))
if (year % 4 == 0 and year % 100 != 0) or (year % 400 ==0):
if momth == 1:
print(day)
elif momth ==2:
print(31 + day)
elif momth ==3:
print(31 + 29 + day)
elif momth ==4:
print(31 + 29 + 31 + day)
elif momth ==5:
print(31 + 29 + 31 + 30 + day)
elif momth ==6:
print(31 + 29 + 31 + 30 + 31 + day)
elif momth ==7:
print(31 + 29 + 31 + 30 + 31 + 30 + day)
elif momth ==8:
print(31 + 29 + 31 + 30 + 31 + 30 + 31 + day)
elif momth ==9:
print(31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + day)
elif momth ==10:
print(31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + day)
elif momth ==11:
print(31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + day)
else:
print(31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + day)
else:
if momth == 1:
print(day)
elif momth ==2:
print(31 + day)
elif momth ==3:
print(31 + 28 + day)
elif momth ==4:
print(31 + 28 + 31 + day)
elif momth ==5:
print(31 + 28 + 31 + 30 + day)
elif momth ==6:
print(31 + 28 + 31 + 30 + 31 + day)
elif momth ==7:
print(31 + 28 + 31 + 30 + 31 + 30 + day)
elif momth ==8:
print(31 + 28 + 31 + 30 + 31 + 30 + 31 + day)
elif momth ==9:
print(31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + day)
elif momth ==10:
print(31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + day)
elif momth ==11:
print(31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + day)
else:
print(31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + day)
标签:入门 简单 计算
原文地址:http://blog.51cto.com/13241097/2113772