I'm trying to create a scientific calculator for an assignment. I'm looking for a bit of help with python syntax, and I think my design and pseudo code are doing well, but for whatever reason python isn't having any of my syntactical issues. Here is the code I have for converting binary to decimal.
I need the code to reprompt when the input is invalid, but when it does reprompt, it gets stuck in a loop of reprompting and won't give me any way out.
def bintodec(var):
    power = (len(var) + 1)
    value = ' '
    while True:
        var = input('Give a number to convert from binary to decimal: ')
        for x in range(len(var)):
            if (ord(var[x]) == 49):
                power -= 1
                value += x * (2 ** power)
            if (ord(var[x]) == 48):
                power -= 1
                value += x * (2 ** power)
            if power == -1:
                break
            else:
                boo = True
    return value
Any help is greatly appreciated!
 
     
     
    