Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Icdt 88 2nd International Conference On Database Theory Bruges Belgium August 31 September 2 1988 Proceedings Lncs 326

Authors: Marc Gyssens ,Jan Paredaens ,Dirk Van Gucht

1st Edition

3540501711, 978-3540501718

More Books

Students also viewed these Databases questions

Question

What Is Psychology?

Answered: 1 week ago