Okay. first of all i know there is a built-in function converting binary to decimal but i thought i challenge myself and make my own.
Here are the codes....
binaryList = list(str(binary))
exponent = len(binaryList) - 1
decimal = 0
for char in binaryList:
bit = int(char)
decimal += bit * (2 ** exponent)
exponent -= 1
Youre problem is mainly
binaryList = list(str(binary)).
'0b101010' as you might expect.
['1', '4', '2'].
A coincidence made that
1 * 2**2 + 4 * 2**1 + 2 equals 14, which gives the impression that you're function don't treat the last digit.
But, if you're running you're function with
0b101010 as input, you get
A solution to get the binary representation as string is to pass to
['1', '0', '0', '0', '1', '1', '1', '0']