Question: Thanks to programming experience and language evolution, we have a rather easy fix to this problem. Python has another kind of data type that is

Thanks to programming experience and language evolution, we have a rather easy fix to this problem. Python has another kind of data type that is exactly applicable here.

Try this example that creates what Python calls a dictionary.

days_in = {'Jan': 31, 'Feb': 28, 'Mar': 31, 'Apr': 30, 'May': 31, 'Jun': 30, 'Jul': 31, 'Aug': 31, 'Sep': 30, 'Oct': 31, 'Nov': 30, 'Dec': 31} 

The Python dictionary is actually designed specifically for associative data. See if you can figure out how to fill in this blank:

month_name = input('Abbreviated month name: ') month_days = days_in[ Please Enter the Answer Here ] print(month_name,'has',month_days,'days')

Hint: The values from a dictionary are not chosen by their position within that dictionary, so this is actually much simpler than the earlier question that looked like this.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!