In function unsortedSearch
you have a parameter named list1
, but in the body of the function it looks like you are referring to it as list
. So change all of your list
with list1
and your current problem will be solved:
def unsortedSearch(list1, i, u):
found = False
pos = 0
pos2 = 0
while pos < len(list1) and not found:
if list1[pos] < u : # <--------------- fixed here
if list1[pos2] > i: # <----------- and here
found = True
pos2 = pos2 + 1
pos = pos + 1
return found
solved Python – ‘type’ object is not subscriptable [closed]