The following code fixes the bugs your one has. Now you have to complete it.
def toDecimal (sNumber, nBase):
decimal = 0
for i in range(len(sNumber)):
digitPos = len(sNumber) - 1 - i
digit = sNumber[digitPos]
digitVal = digitToValue(digit, nBase)
if (digitVal == -1):
return -1
posVal = nBase ** i
product = digitVal * posVal
print(digit, "x", nBase, "^", i, "=", digitVal, "x", posVal, "=", product)
decimal += product
return decimal
numberIn = input("Enter a number: ")
baseIn = input("Enter base from: ")
convertTo = input("Enter base to convert to: ")
decimalOut = toDecimal(str(numberIn), baseIn)
print(decimalOut)