Answers for "sequential search calculator"

0

sequential search calculator

def sequential_search(alist, item):
    position = 0

    while position < len(alist):
        if alist[position] == item:
            return True
        position = position + 1

    return False

testlist = [63, 45, 32, 98, 46, 57, 28, 100]

sequential_search(testlist, 3)  # => False
sequential_search(testlist, 13)  # => True
Posted by: Guest on August-02-2021

Browse Popular Code Answers by Language