whenever I run my code I get a TypeError saying "not all arguements converted during string formatting" and I tried using str() around what didn't get converted but I ran into more errors.
Here is my code:
def decimalToBinary(num):
bits = " "
while(num > 0):
bits = str(num%2) + bits
num = num//2
return bits
def binaryToDecimal(bits):
deciNum = 0
powers = 0
for i in reversed(bits):
deciNum = 2 **powers** (bits % 10)
bits /= 10
powers += 1
return deciNum
#program tester
for i in range(135, 146):
x = decimalToBinary(i)
deciNum = binaryToDecimal(x)
print(str(decimal))+ ' is '+ ' in Binary.'
I get this TypeError on the line that says "deciNum = 2 ** powers ** (bits%10)