Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started