Question: Task 4 : Working with lists In [ ] : food = [ ' ranen ' , 'potato', 'chicken nuggets', 'pineapple' ] 4 a .
Task : Working with lists
In : food ranen 'potato', 'chicken nuggets', 'pineapple'
a Pri
In :
b Change 'potato' to another food and print the whole list to check
In :
c Ac
In :
d Use slicing to view the rd to last items of the list.
In :
e Reverse the list!
In :
f 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
In :
In :
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
