Skip to content

Instantly share code, notes, and snippets.

@computer-tutor
Last active May 8, 2021 09:58
Show Gist options
  • Save computer-tutor/f4df14ed5ace5a4a7f37e23bab732520 to your computer and use it in GitHub Desktop.
Save computer-tutor/f4df14ed5ace5a4a7f37e23bab732520 to your computer and use it in GitHub Desktop.
mo={'January':31,'February':28,'March':31,'April':30,'May':31,'June':30,
'July':31,'August':31,'September':30,'October':30,'November':30,
'December':31}
m=input("\nEnter a month:")
print('\nNumber of days in', m,'is',mo.get(m.strip(),'Enter again:'))
print("\nAll months in sorted order are as follows: ",sorted(mo))
for i in mo:
if mo[i]==31:
print ('\nMonth having 31 day is:',i, end=' ')
print()
v=sorted([(i,j) for j,i in mo.items()])
print('\nKey,value pairs in sorted order are:',[(j,i) for i,j in v])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment