I'm attempting to get a binary string from a user and convert it into decimal. However when I do this I am not getting the right total, I'm getting numbers bigger than what their decimal conversion is and I cannot understand why for some reason... Thank you.
I have tried to change around the variables
binary_str = input("Please input the binary string: ")
Power = 7
Total = 0
for char in binary_str:
product = int(char) * 2**Power
Total += product
set_power = Power - 1
print(Total)
The output was 512 when the number was supposed to be in the 200s