I want to convert a binary string (user input) to its base 10 equivalent value. I think I am somewhat close but just can't get it. This is what I have come up with so far. I need it to go through each individual number in the binary string and assign its base 10 equivalent value, then add all of those up for the entire base 10 number.
def getBaseTen(myString):
x = myString[0]
needAnswers = len(myString)
n = len(myString)
two = (2^n)
if (needAnswers >= 1):
return (int(x)*int(two))