Demo entry 6698514

d

   

Submitted by anonymous on Jan 25, 2018 at 13:29
Language: Python 3. Code size: 262 Bytes.

def Sequential_Search(arr, item):
    pos = 0
    found = False
    
    while pos < len(arr) and not found:
        if arr[pos] == item:
            found = True
        else:
            pos = pos + 1
    
    print(found, pos)
    return found, pos

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).