'''lecture_37_linear_search.py Use recursion to sum a list Oliver W. Layton CS 151: Computational Thinking: Visual Media Fall 2020 ''' def linearSearch(list, elem): '''Return the index of `elem` in `list` (if exists). If not in list, return -1. ''' for i in range(len(list)): if list[i] == elem: print(':)') return i print(':(') return -1 if __name__ == '__main__': myList = [10, 3, 2, 3, 9, 99, 100, 15, 16] # elem = 99 elem = 990 print('The position of', elem, 'is', linearSearch(myList, elem))