这是我的代码:def cal(month):
if month in ['January', 'march','may','july','august','oct','dec']:
print ("this month has 31 days")
elif month in ['april','june','sept','nov']:
print ("this month has 30 days")
elif month == 'feb' and leap(year)== True:
print ("this month has 29 days")
elif month == 'feb' and leap(year) == False:
print ("this month has 28 days")
else:
print ("invalid input")
def leap(year):
if (year % 4== 0) or (year % 400 == 0):
print ("its a leap year!")
else:
print ("is not a leap year")
year = int(input('type a year: '))
print ('you typed in :' , year)
month = str(input('type a month: '))
print ('you typed in :', month)
cal(month)
leap(year)
我收到的输出:
^{pr2}$
如果是28天或29天,为什么我没有得到2月份天数的输出?在
为什么我得到无效的输入部分,即使它是另一个?在