Question: Python Language Lists, slicing and for statements. Given the list named pizzas : pizzas = ['cheese', 'pepperoni', 'margherita', 'hawaiian', 'italian sausage', 'green peppers and onions']
Python Language
Lists, slicing and for statements. Given the list named pizzas :
pizzas = ['cheese', 'pepperoni', 'margherita', 'hawaiian', 'italian sausage', 'green peppers and onions']
- Using for statements, the string method called find and the method of lists called append, append in the list loc_e the index of the first 'e' that appears in each element in the pizzas list, and print the list loc_e.
Note: The find method will return -1 if element is not found.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
