Question: Given the following list in Python: initial _ foods = [ ' pizza ' , 'Gatsby', 'pap', 'pasta', 'burger' ] create a function called foods
Given the following list in Python: initialfoods pizza 'Gatsby', 'pap', 'pasta', 'burger' create a function called foods that Perform the following operations stepbystep and present your final code:
Create a copy of the initialfoods list and store it in a new list called favoritefoods.
Print the favoritefoods list.
Check the length of the favoritefoods list and print the result.
Add 'sushi and oysters to the favoritefoods list.
Remove 'Gatsby' from the favoritefoods list using the appropriate list method.
Sort the favoritefoods list in alphabetical order and print the sorted list.
Reverse the order of the favoritefoods list and print the reversed list.
Using a for loop, iterate over the favoritefoods list and print each food item prefixed with "I love eating", eg "I love eating pap."
Answer text Question
Rich text editor
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
