Skip to content

Instantly share code, notes, and snippets.

@computer-tutor
Last active May 8, 2021 09:58
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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