Write the definition of a method/function SearchOut(Teachers,
TName) to search for TName from a list Teachers, and display the
position of its presence.
For example :
If the Teachers contain
["Ankit", "Siddharth", "Rahul", "Sangeeta", "Rahul"]
and TName contains "Rahul"
The function should display
Rahul at 2
rahul at 4
Teachers=["Ankit", "Siddharth", "Rahul","Sangeeta", "rahul"]
def SearchOut(Teachers,TName):
for i in range(len(Teachers)):
if(Teachers[i].lower()==TName.lower()):
print(TName,"at",i)
SearchOut(Teachers,"Rahul")
Write a function INDEX_LIST(L), where L is the list of elements passed as argument to the function.
The function returns another list named indexList that stores the indices of all Non-Zero Elements of L.
For example:
If L contains [12,4,0,11,0,56]
The indexList will have - [0,1,3,5]