Question: #Create one tuple for storing the months... monthTuple = ( ' January ' , 'February','March', 'April', 'May', 'June', 'July', 'August', 'September', October, November, December )

#Create one tuple for storing the months...
monthTuple =('January', 'February','March', 'April', 'May', 'June', 'July', 'August', 'September', "October", "November", "December")
#Check if the userMonth is not in monthTuple then print the Invalid...
if not(userMonth in monthTuple):
print("Invalid")
#Check for the March month with userDay...
elif userMonth == 'March':
if not(1<= userDay <=31):
print("Invalid")
elif userDay <=19:
print("Winter")
else:
print("Spring")
#Check for the April month with userDay...
elif userMonth == 'April' :
if not(1<= userDay <=30):
print("Invalid")
else:
print("Spring")
#Check for the May month with userDay...
elif userMonth == 'May':
if not(1<= userDay <=31):
print("Invalid")
else:
print("Spring")
#Check for the June month with userDay...
elif userMonth == 'June':
if not(1<= userDay <=30):
print("Invalid")
elif userDay <=20:
print("Spring")
else:
print("Summer")
#Check for the July month with userDay...
elif userMonth == 'July':
if not(1<= userDay <=31):
print("Invalid")
else:
print("Summer")
#Check for the August month with userDay...
elif userMonth == 'August':
if not(1<= userDay <=31):
print("Invalid")
else:
print("Summer")
#Check for the September month with userDay...
elif userMonth == 'September':
if not(1<= userDay <=30):
print("Invalid")
elif userDay <=21:
print("Summer")
else:
print("Autumn")
#Check for the October month with userDay...
elif userMonth == "October":
if not(1<= userDay <=31):
print("Invalid")
else:
print("Autumn")
#Check for the November month with userDay...
elif userMonth == "November":
if not(1<= userDay <=30):
print("Invalid")
else:
print("Autumn")
#Check for the December month with userDay...
elif userMonth == "December":
if not(1<= userDay <=31):
print("Invalid")
elif userDay <=20:
print("Autumn")
else:
print("Winter")
#Check for the January month with userDay...
elif userMonth == 'January':
if not(1<= userDay <=31):
print("Invalid")
else:
print("Winter")
#Check for the February month with userDay...
elif userMonth == "February":
if not(1<= userDay <=29):
print("Invalid")
else:
print("Winter")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!