Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Linear Search Python with enumerate

def linear_search(lst, target):
    for index, value in enumerate(lst):
        if value == target:
            return index
    return -1
Source by teamtreehouse.com #
 
PREVIOUS NEXT
Tagged: #Linear #Search #Python #enumerate
ADD COMMENT
Topic
Name
9+6 =