bi = input("Adj meg egy bináris számot: ") out = 0 d = 0 for s in range(len(bi)-1,-1,-1): if int(bi[s]): out += 2**d d += 1 print(out)