Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions