• ... and my code doesn't work again :(

Question related to mission Most Efficient Cutting

 
def most_efficient_cutting(bom):

    bom.sort()
    rem = 6000
    for length in bom:
        if rem == length:
            rem = 0
        elif rem != length:
            rem = rem - length     

    return rem