#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()