Question: in python create code that allows the user to enter an acronym, look it up in the dictionary, and display the corresponding meaning. The procedure
in python create code that allows the user to enter an acronym, look it up in the dictionary, and display the corresponding meaning. The procedure is also the same: Using the requests module, get the content at the URL, receive it as a string responsetext parse the string into a dictionary one line at a time, and then move into the user interaction section. As usual, please allow the user to look up multiple acronyms keep asking them until they choose
But here are the differences: The data is formatted differently, details below The user may search for an acronym that is NOT found in the dictionary, details below
The data from the inclass example was already condensed for us Each acronym was only listed once, and the various meanings were all listed with that one entry. This time, each possible meaning has its own line in the file. Youll first need to CHECK THE DICTIONARY hint below to see if that key already exists, and then addappend the secondthirdNth entry onto the end of the value. But a dictionary in Python may not have multiple entries with the same key. Example: AA Administrative Assistant AA Administrative Authority AA Affirmative Action committee AA Alcoholics Anonymous AA American Airlines AA Antiaircraft Artillery AA Associate in Accounting AA Astronomy and Astrophysics AA Auto Answer AA Automobile Association All of those lines need to end up in one dictionary entry. The Key should be AA and the Value should be Administrative Assistant, Administrative Authority, Affirmative... There are some entries for which there are duplicate identical meanings. Thats okay just add the meaning twice pretend they are different in some subtle way Example: AI. artificial intelligence AI. artificial intelligence Key AI.including the periods Value artificial intelligence, artificial intelligence
If the user searches for an acronym that is not found, you should display something helpful like Acronym was not found in the list Hint: if key variable name in dictionary variable name: # code for what to do if its found else: # code for what to do if its NOT found Optional extra credit point You might allow the user to ADD that acronym to the dictionary, if they provide a value for the meaning
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
