I have tried this code multiple times. But I'm always getting the output as 45, which is wrong.
a = [1, 0, 1, 1]
value = 0
a.reverse()
print(a) #reversed list
for i in a:
if i==1:
for x in range(0,len(a)):
value += pow(2,x)
else:
continue
print("decimal value of binary number is:",value)
binfunction?