MCPcopy Create free account
hub / github.com/geekcomputers/Python / linearsearch

Function linearsearch

linear search.py:4–8  ·  view source on GitHub ↗
(arr, x)

Source from the content-addressed store, hash-verified

2
3
4def linearsearch(arr, x):
5 for i in range(len(arr)):
6 if arr[i] == x:
7 return i
8 return -1
9
10
11arr = ["t", "u", "t", "o", "r", "i", "a", "l"]

Callers 1

linear search.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected