I’m sharing a program that converts binary to decimal in python.
# make a new function
def bintodeci(num):
reverse = len(num) -1
exp = 0
total = 0
# range(start, stop, step)
for digit in range(reverse, -1, -1):
total += int(num[digit]) * (2**exp)
exp += 1
# return the value
return total
answer = bintodeci("11")
print(answer)
sample output:
10
bai.