Skip to content

Instantly share code, notes, and snippets.

@MorkHub
Created November 8, 2016 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MorkHub/b2d406d1ded6b5888dc2c78906d67a0f to your computer and use it in GitHub Desktop.
Save MorkHub/b2d406d1ded6b5888dc2c78906d67a0f to your computer and use it in GitHub Desktop.
while True:
seasons = ["Winter","Spring","Summer","Autumn"]
months = [
["December","January","February"],
["March","April","May"],
["June","July","August"],
["September","October","November"]
]
thirtyone = ["January","March","May","July","August","October","December"]
thirty = ["April","June","September","November"]
month = input(" 5. Enter a season: ",type=str).capitalize()
if month == 'Stop':
break
i = 0
found = False
for season in months:
if month in season:
print(" %s is in %s." % (month,seasons[i]),end='')
if month in thirtyone:
print(" There are 31 days in %s" % month)
elif month in thirty:
print(" There are 30 days in %s" % month)
elif month == "February":
print(" There are 28 days in February")
found = True
i = i + 1
if not found:
print(" %s is not a valid month." % month)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment