# Sort items
import pickle

def write(bins):
    file = open("bins.txt","w+b")
    pickle.dump(bins, file)
    file.close()

def sort(input):
    file = open("bins.txt","a+b")
    file.close()
    file = open("bins.txt", "rb")
    bins = pickle.load(file)
   

    if len(bins) == 0:
        bins = ['Unknown']
    file.close()
    write(bins)
    #file.write(str(bins))
    if bins.count(input) == 0:
        bins.append(input)
    bin = bins.index(input)
    #print(str(bins))
    #print(bin)
    write(bins)
    return bin

def clear():
    write(["Unknown"])
#write(["Unknown"])