In [ ]:
#define main function 
def main():
    binaryInput = input("Enter random binary number ==> ")
    #exponentValue equals the len ,binary input
    exponentValue = len(binaryInput)
    #decimal value when your done
    totalValue = 0
    #deleting the values then adding a main()
    if exponentValue < 1:
        del binaryInput
        #deletes Binaryinput
        del exponentValue
        #deletes exponent Value
        del totalValue
        #deletes total value
        print("you just only pressed eneter, give a value to run")
        #prints
        main()
        #this restarts the program I am running
        #conversion is going to go through each item in conversion or each letter
    for conversion in range(exponentValue):
        print(conversion)
        #prints conversion
        print(binaryInput[conversion])
        #prints binary input and conversion
        if binaryInput[conversion]== "0":
            acutalValue = 0
        elif binaryInput[conversion] =="1":
            actualValue = 2
    else:
        #deletes the program then main() restarts the program
        print("enter numbers")
        #prints the numbers you type
        del binaryInput
        #deletes binary input
        del exponentValue
        #deletes exponentvalue
        del totalValue
        #deletes totalvalue
        
        #main() restars the program
        main()
        #0 to the power of 0 = 1
        #2 to the power of 0 = 1
        #1 to the power of 0 = 1
        #0 to the power of 1 = 0
        #any thing to the power of 0 = 1
        
    
        
        #allows you to get to the value of 0
        trueValue = actualValue ** (exponentValue -1)
       
    if actualValue == 0 and exponentValue == 1:
        trueValue = 0
        
    exponentValue -= 1 
    #this is the exact same format
    exponentValue = exponentValue -1
        #total value + true value = true value
    toalValue += trueValue
    print("The decimal value value of {} is {}".format(binaryInput,totalValue))
    quit()
    #quits the program
main()
Enter random binary number ==> 500023232
0
5
1
0
2
0
3
0
4
2
5
3
6
2
7
3
8
2
enter numbers
Enter random binary number ==> 
you just only pressed eneter, give a value to run
In [ ]:
 
In [ ]: