I have a function for run length decoding in Python. It is working with single digit numbers, but if my number is above 9, it doesn't work. As you can see in my code, I want to print c 11 times, but it only prints it one time. How can I fix it ? I want to keep the code I have, without any special libraries. Example: Input is (A2B3C11) then output should be (AABBBCCCCCCCCCCC), but currently my output is only (AABBBC)
def run_length_decoding(compressed_seq):
seq = ''
for i in range(0, len(compressed_seq)):
if compressed_seq[i].isalpha() == True:
for j in range(int(compressed_seq[i + 1])):
seq += compressed_seq[i]
return (seq)
print(run_length_decoding('A2B3C11'))