### # linear_search.py # # author: Kristina Striegnitz # # version: 2/7/2010 # # Check whether a given element is in a list. List can be ordered or # unordered. ### def linear_search(val, l): for element in l: if element == val: return True return False # Another way of writing this. What is the difference? def linear_search2(val, l): found = False for element in l: if element == val: found = True return found