A photonic beam sweeps left-to-right until the target resonates.
def linear_search(arr, target):
for i in range(len(arr)):
if arr[i] == target:
return i # Found
return -1 # Not Found
Dynamically typed and interpreted — every comparison and swap is dispatched by the interpreter at run time, so tight loops run roughly 10–100× slower than compiled C/C++. Unbeatable for learning the idea with the least code; not what you reach for when the inner loop is the bottleneck.