Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN python grList (11) Write a function grlist that takes a list 11 which includes the list of items for the grocery shopping. Assume you

IN python

image text in transcribed

grList (11) Write a function "grlist" that takes a list "11" which includes the list of items for the grocery shopping. Assume you need to do grocery shopping for you and your friend. Your friend is allergic to peanut and carrot, so you should not buy them for him. You need to replace these two items with apple. Your function should check your shopping list and print a list for you and your friend. Since the function only accept one list as an input, you need to create your friends list and modify it inside the function. Your code should be work with any length of the list. Print your friend's list first. (Do not worry about the output formatting) Sample Input 1 11 -["water", "chips", "watermelon", "peanut", "napkins"] Sample Output 1 My friend needs ['water', 'chips','watermelon', 'apple','napkins' I need ['water', 'chips', 'watermelon', 'peanut', "napkins'] Sample Input 2 11"candy", "lemonade", "ginger", "bread", "water"] Sample Output 2 My friend needs ["candy", "lemonade", "ginger", "bread", "water"] I need ["candy", "lemonade", "ginger", "bread", "water" sample Input 3 11-["candy", "peanut", "carrot", "bread", "water"] Sample Output 3 My friend needs ["candy", "apple", "apple", "bread", "water"] I need ["candy", "peanut", "carrot", "bread", "water"]

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

Write a detailed text about the future of the banking sector.

Answered: 1 week ago

Question

4. Label problematic uses of language and their remedies

Answered: 1 week ago