In [1]:
# Create a function to search a list of numbers for a given number and return the index of that number in the list
In [7]:
def search(alist, search_term):
for i in range(0, len(alist)):
if search_term == alist[i]:
return i
# if end of list and search term hasn't matched then return "not in list"
if i == len(alist) - 1 and search_term != alist[(len(alist) - 1)]:
return 'Not in list'