Question: Task 4 : Working with lists In [ ] : food = [ ' ranen ' , 'potato', 'chicken nuggets', 'pineapple' ] 4 a .

Task 4: Working with lists
In []: food =['ranen', 'potato', 'chicken nuggets', 'pineapple']
4a. Pri
In []:
4b. Change 'potato' to another food (and print the whole list to check).
In []:
4c. Ac
In []:
4d. Use slicing to view the 3rd to last items of the list.
In []:
4e. Reverse the list!
In []:
4f. List comprehension
List comprehension allows you to make a new list by performing some operation on each item of an existing list. You can read more about it here.
Use list comprehension to create a new list of all the foods in the food list that contain the letter e.
In []:
In []:
 Task 4: Working with lists In []: food =['ranen', 'potato', 'chicken

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!