liste binaire à décimal

def binarylist_to_decimal(lst):
    power=0
    nb=0
    for i in range(len(lst)-1,0-1,-1):
        nb+=lst[i]*(2**power)
        power+=1
    return nb

bin_lst=[1,1,1,1,1,1,1,1]
power=0
nb=0
print(binarylist_to_decimal(bin_lst))

# 255
Bored Buffalo