Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def add_items(a11_items): #your code here return all_items def delete_item(al1_items,item): #your code here return all_items #DO Not change the code below def main(): all_items = [honey,

image text in transcribed
image text in transcribed
def add_items(a11_items): \#your code here return all_items def delete_item(al1_items,item): \#your code here return all_items \#DO Not change the code below def main(): all_items = ["honey", "ranch", "ketchup"] all_items=add_items(all_items) print("AlL items after adding new items = ", all_items) item=input("Which i them do you want to delete: ") items_after_del=delete_item(all_items, item) print("AlL items now = ;items_after_del) You are hired by a grocery store manager to write a program which adds items and delete an item from the grocery store. Here are the instructions: 1. Write a function named add_items which takes a list of existing items as a parameter and adds new items to that list. After adding each item, the function should ask if the user wants to continue adding new items to the list. As long as the user's answer starts with " y " or " Y ", the function must keep asking the new item. 2. Write a second function that named delete_item that takes the item list and to be deleted item as inputs. Then, the function returns the updated list after deletion. If the item is not in the grocery store, give a message as "There is no such item." * main function is already given to you. Do not forget to use the starter code. Sample Outputs Item name: onion Do you want to continue adding items?: = Yes Item fiame: tea Do yot want to continue adeding items?: No A1l itura after adding new itemis = ['honey', 'ranch', 'ketchup', 'onion', 'teat'. Which item do you want to delete? ranch All. itemas now = ("honey', ' ketchup', ' onion', ' cea'l Itam mume: garlie Do you wrant to continue adding 1tamax : Y Item. namez-tea. Do yelf watit to-continue adding itene?? nope Whichistern do you want to terfezeg mustard

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

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

Students also viewed these Databases questions