def bin2de(x):
    """convert binary to decimal
    input: 11110000
    output: 15
    """
    n = 7
    de = 0
    while n >= 0:
        de = de + int(x[n]) * 2 ** (7 - n)
        n = n - 1
    return de
