Run ❯
Get your
own Python
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
def linearSearch(arr, targetVal): for i in range(len(arr)): if arr[i] == targetVal: return i return -1 mylist = [3, 7, 2, 9, 5, 1, 8, 4, 6] x = 4 result = linearSearch(mylist, x) if result != -1: print("Found at index", result) else: print("Not found")
Found at index 7