Useful code that helped me visualize this statement: " If the middle element of the list is smaller than the last element of the range, then the answer lies to the left of it. Otherwise, the answer lies to the right."

#deteremining number of list rotations (binary search assignment)

#trying to visualise rotated list

import matplotlib.pyplot as plt

%matplotlib inline

def vis_rot(nums):

#takes list of integers as argument

neg_nums = [-i for i in nums] #plotting mirrored image

x = [str(val) for val in nums] #maintain list order

kwargs = {‘color’: ‘black’,‘align’: ‘edge’,‘width’: 1}

plt.bar(x,nums,**kwargs)

plt.bar(x,neg_nums, **kwargs)

plt.tick_params(left = False,labelleft = False)

plt.show()