Assignment 1 - Binary Search Practice - Question 8. Implement the solution and test it using example inputs

My test cases list is
[{‘input’: {‘nums’: [19, 25, 29, 3, 5, 6, 7, 9, 11, 14]}, ‘output’: 3},
{‘input’: {‘nums’: [3, 4, 5, 6, 7, 0, 1, 2]}, ‘output’: 5},
{‘input’: {‘nums’: [3, 4, 6, 7, 8]}, ‘output’: -1},
{‘input’: {‘nums’: [9, 3, 5, 6, 7, 8]}, ‘output’: 1},
{‘input’: {‘nums’: [2, 3, 4, 5, 6, 7, 8, 1]}, ‘output’: 7},
{‘input’: {‘nums’: [0, 1, 2, 3, 4, 5, 6, 7]}, ‘output’: 0},
{‘input’: {‘nums’: []}, ‘output’: 0},
{‘input’: {‘nums’: [5]}, ‘output’: 0}]
When I ran the tests on Question 8 code i got the error below on Case 4

TEST CASE #4
lo: 0 , hi: 7 , mid: 3 , mid_number: 5
lo: 4 , hi: 7 , mid: 5 , mid_number: 7
lo: 6 , hi: 7 , mid: 6 , mid_number: 8
lo: 7 , hi: 7 , mid: 7 , mid_number: 1

IndexError Traceback (most recent call last)
/tmp/ipykernel_38/2295521840.py in
----> 1 binary_search_results = evaluate_test_cases(count_rotations_binary, tests)

/opt/conda/lib/python3.9/site-packages/jovian/pythondsa/init.py in evaluate_test_cases(function, test_cases, error_only, summary_only)
85 if not error_only:
86 print("\n\033[1mTEST CASE #{}\033[0m".format(i))
—> 87 result = evaluate_test_case(function, test_case, display=False)
88 results.append(result)
89 if error_only and not result[1]:

/opt/conda/lib/python3.9/site-packages/jovian/pythondsa/init.py in evaluate_test_case(function, test_case, display)
63
64 start = timer()
—> 65 actual_output = function(**inputs)
66 end = timer()
67

/tmp/ipykernel_38/2092307705.py in count_rotations_binary(nums)
10 print(“lo:”, lo, “, hi:”, hi, “, mid:”, mid, “, mid_number:”, mid_number)
11
—> 12 if mid > 0 and nums[mid-1] > mid_number < nums[mid+1]:
13 # The middle position is the answer
14 return mid

IndexError: list index out of range

I need help

Haa, I have been able to spots the mistakes