plz ans fast
Write a python program to create a dictionary named year whose
keys are month names and values are their corresponding number of
days.
Answers
Answer:
वर्ष नाम से एक शब्दकोश बनाने के लिए एक अजगर कार्यक्रम लिखें, जिसकी कुंजी महीने के नाम और मूल्य हैं, जो दिनों की इसी संख्या है
Answer:
year={"Jan":31,"Feb":28,"March":31,"April":30,"May":31,"June":30,"July":31,"Aug":31,"Sept":30,"Oct":31,"Nov":30,"Dec":31}
name=input("Enter the mounth name in short form:")
print("No of days in the month of",name,"is=",year[name.capitalize()],"days")
print("Months sorted in alphabetical order are:",sorted(year))
months=[]
for i in year:
if year[i]==31:
months.append(i)
print("Months having 31 days are:",months)
lst1=[]
lst2=[]
count=30
for i in year:
if year[i]<=count:
lst1.append((i,":",year[i]))
else:
lst2.append((i,":",year[i]))
print("(key-value) pairs sorted by the number of days in each months are:",lst1+lst2)
Explanation: