Computer Science, asked by Prajnya5284, 7 months ago

Find Occurrences of an Element in a List IN PYTHON
Step 1: Define a function with two parameters, first parameter will be the list of values i.e. elements_list and second parameter will be the item to be searched i.e. key.
Step 2: Inside this function, create an empty list to store the result i.e. result_list.
Step 3: Inside the function, elements_list list is iterated using for loop and range() function which traverses till the length of the elements_list. Use list indexing here.
Inside for loop, check whether an element in the elements_list matches the item being searched i.e. key.
If it matches, then append the index number or position of that item in the elements_list to the result_list.
This for loop iterates till the end of elements_list.
Step 4: Return the result_list list which contains the indices or positions of the item key in elements_list.
Step 5: Call the function and pass the list of items and item to be searched to the list as parameters.

Answers

Answered by hema091235
0

Answer:

I knew answer First Follow me then I will answer you

Explanation:

Follow me first then I will answer you

Similar questions