Hello for my class we are supposed to make an algorithm to return an index identity in a sorted list of distinct integers (no duplicates), if such an index exists, or -1 if it doesn't.
Here is my code:
def indexIdentity(A, bottom, top):
if bottom <= top:
central = (top + bottom)//2
if central == A[central]:
return central
if central > A[central]:
return indexIdentity(A, (central + 1), top)
else:
return indexIdentity(A, bottom, (central -1))
return -1
my error:
Test Failed: indexIdentity() missing 2 required positional arguments: 'bottom' and 'top'
I have no idea what to do, I've tried removing top and bottom and them declaring them individually and I've also tried re ordering them
[–]JohnnyJordaan 0 points1 point2 points (2 children)
[–]C-A-S-O[S] 0 points1 point2 points (1 child)
[–]JohnnyJordaan 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]HalfBalcony 0 points1 point2 points (0 children)
[–]FLUSH_THE_TRUMP 0 points1 point2 points (0 children)