我正在尝试让用户输入相关月份的正确日期,例如没有好的进入二月30,或六月31。这是我的代码,但我不断收到elif
语句的语法错误。那是为什么?
if month == ('February') and (LeapYear == False):
maxday == 28
if month == ('February') and (LeapYear == True):
maxday == 29
if month == ('April') or ('June') or ('September') or ('November'):
maxday == 30
else:
maxday == 31
while True:
which_day = int(input("Enter a positive number, 1 to 31 or to quit: "))
if which_day < 0 or which_day > maxday:
print("day for month incorrect - try again..please!")
continue
elif which_day <= maxday:
print("OK, we can go from here...!")
print (maxday , which_day)
break
print("All done!")