I tried looking up a previous question but nothing popped up. My professor wants us to create a program with Python that can convert Binary back to Text, by entering one byte at a time. I tried to use the following code, but my accumulator keeps failing to work. Do you have any idea what I'm doing wrong?
def main():
length = int(input('How many characters would you like to convert with binary?'))
accu = ''
for i in range(length):
binary = input('Enter some binary and I will make it into text: ')
base = int(binary, base = 2)
decoded = chr(base)
print(decoded)
decoded + str(accu)
print(accu)
main()
accu
without storing anything in it? You are just initializing it with a empty string and the value ofdecoded + str(accu)
is not beeing stored anywhere...