I was instructed to run the current code and understand the error message and change only one line of the function bs and fix the error I can kind of understand what the error message is saying, but I don't know how to fix it or where the actual problem is occurring in the function bs
def bs(L, item, left, right):
if right is None:
right = len(L)
if right - left == 0:
return False
if right - left == 1:
return L[left] == item
median = (right + left)//2
if item < L[median]:
return bs(L, item, left, median)
else:
return bs(L, item, median, right)
L = [i for i in range(10)]
for i in range(20):
print(bs(L, i))
The error is the following
print(bs(L, i))
TypeError: bs() missing 2 required positional arguments: 'left' and 'right'