How do I assine an adress to each item in the list? : I'm trying to create a binary search however I get the error 'list indices must be integers, not str' with the line 'i == alist[i]'. Please could you help me fix the problem. Heres the whole code.

    def bsort(alist, i):
        left = 0
        right = len(alist)-1
        i == alist[i]
    
        [mid] = (left + right)//2
    
        if alist[mid] < i :
            left = [mid] + 1
    
        elif alis[mid] > i :
            right = [mid] + 1
    
        elif alist[mid] == i :
            print ("word found at", i )
    
        elif left > right:
            print ("Not Found!")       
            
    
    i = input("Enter a search >")
    alist = ["rat","cat","bat","sat","spat"]
    bsort(alist, i)

Thank you. 
