In [ ]:
#This would be display text before the line you put you binary inputs in 
def main():
    binaryInput = input("Enter a binary number ==>")
    exponentValue = len(binaryInput)
    totalValue = 0
# This deletes the def main if you just press the enter key and there isn't any number instead displaying a error it would just say the sentence you want it to 
    if exponentValue < 1:
        del binaryInput
        del exponentValue 
        del totalValue 
        print("All you did was press enter, I need a value")
        main()
    #if the binary input is 0 or 1 then the value would be 0 and 2 
    for conversion in range(exponentValue):
        if binaryInput[conversion] == "0":
            actualValue = 0 
        elif binaryInput[conversion] == "1":
            actualValue = 2 
        else:
           #This would "delete" your if and elif text if you input a letter or a number that isn't a one or a zero
            print("0 or 1 please") 
            del binaryInput
            del exponentValue
            del totalValue 
            main()
        
        trueValue = actualValue ** (exponentValue -1)
        # the if statement means that if the actual value being 0 and the exponent value being 1 they would equal 0 which would be the true value
    
        if actualValue == 0 and exponentValue == 1:
            trueValue = 0
        
        exponentValue -= 1
    
        
        totalValue += trueValue
   #This means that the binary value would be in the first bracket and the decimal value would be in the second bracket 
    #This is also is how it will present your answer
    print("The decimal value of {} is {}".format(binaryInput, totalValue))      
        #quit()
        
main()    
In [11]:
a = 0 ** 1
b = 0 ** 0
print(a)
print(b)
0
1
In [ ]: