
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question

Transcribed Image Text:Q Write a program (Python) that
constructs a dictionary based on the
user input. then deffendey "deletes)"
Key-value pairs, and displays if
the deletion is successful or not.
The program muit work exactly
Like the example.
Input
Y
Apple
7.99
N
Ý
Grape
Y
Apple
Result
Start addition !
Add more fruits? Y/N% Y
Enter fourt name to be added:
Enter fruit
price
more fruits ? VIN: N
Apple
to be added: 7.99
Add
{ 'Apple': 7.99}
Start deletion !
Delete move fruits ? Y/N : Y
Enter fruit name :
Grape
Sorry, there is no price of Grape
storage.
in
Delete more froits? YIN: Y
Enter fruit name: Apple
Price of Apple is $7.99 has
been deleted.
Delete
move fruits? YININ
Expert Solution

arrow_forward
Step 1
The python program is given below:
Step by stepSolved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- need help with python code. can you please keep it simple, I mean can you not use high-level python codes to answer this.arrow_forward# python demo script to illustrate dictionary usage to replace words in a sentenceInput is word pairs exactly with same whitespaces as here: Hi Hello Thanks Thank-you Bye Goodbye (one space between pairs, two spaces between every pairs)In a user's input sentence example as follows: Hi there, Thanks, Bye using the above given pairs as a dictionary to replace corresponding words in the input sentence, and the output becomes:Hello there, Thank-you, Goodbye Read input from user, first word pairs, then the sentence, split, loop over elements to replace what's entered from pair words into entered sentence. Comments are very important so I can understand. Thanksarrow_forward4- Given a dictionary: capitals= {'CHINA': 'BEIJING','CUBA': 'HAVANA', 'USA': 'WASHINGTON, D.C.'} Write a python program to print keys and values in new line. Example output: CHINA BEIJING CUBA . . .arrow_forward
- python Using try/except block and a for looparrow_forwardIn python make a function with the parameter of a dict[str, str] the function will simply invert the dictionary do not use .get, .item, .values, or import builtins If you encounter more than one of the same key when trying to invert the key and value, raise a keyerror for example ['john': 'white', 'garcia': 'white'], should trigger the raise KeyError callarrow_forwardData structure: Using Java,arrow_forward
- PYTHON Complete the function below, which takes two arguments: data: a list of tweets search_words: a list of search phrases The function should, for each tweet in data, check whether that tweet uses any of the words in the list search_words. If it does, we keep the tweet. If it does not, we ignore the tweet. data = ['ZOOM earnings for Q1 are up 5%', 'Subscriptions at ZOOM have risen to all-time highs, boosting sales', "Got a new Mazda, ZOOM ZOOM Y'ALL!", 'I hate getting up at 8am FOR A STUPID ZOOM MEETING', 'ZOOM execs hint at a decline in earnings following a capital expansion program'] Hint: Consider the example_function below. It takes a list of numbers in numbers and keeps only those that appear in search_numbers. def example_function(numbers, search_numbers): keep = [] for number in numbers: if number in search_numbers(): keep.append(number) return keep def search_words(data, search_words):arrow_forwardProblem 2-Python We have a dictionary where the keys are the names of all your relatives and the values are their ages. Write a Python program to iterate/loop over the dictionary and find the oldest member of your family. Sample output: The oldest relative is Helko. Recall: Iterating over a dictionary iterates over its KEYS. HINT: First we initialize maximum_age to 0 and maximum_age_relative to and empty string. These variables will be updated during the loop. Then we need to iterate over the keys of the dictionary my_family to find the member and their age.If the age is greater than the current maximum_age, we update maximum_age with this new maximum age. Then we update the maximum_age_relative with the new member. Given Code: my_family = {'Bob':72, 'Susan':39, 'Helko':81, 'Gertrude':4} maximum_age = 0 maximum_age_relative = ""arrow_forwardCan anyone help solving this problem In Pythonarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education