Answer the question
In order to leave comments, you need to log in
Why does an index error occur when accessing a row?
Good day to all.
I am solving a problem in Python to decode a string.
s_zip = "r12t1x1N15P5i17L2N2u4D8e18V1N1e1N14f1D4H10k2Y19n8R18T13a6B14G18e10L6k20q3l1"
s_out = ""
print(s_zip)
part_of_string = ""
count_str = ""
count = 0
for i in range(0, len(s_zip)):
j = i+1
if s_zip[i].isalpha():
part_of_string = s_zip[i]
if s_zip[i].isdigit() and s_zip[j].isalpha():
count_str += s_zip[i]
count = int(count_str)
while count < 0:
s_out += part_of_string
count -= 1
count_str = ""
if s_zip[i].isdigit() and s_zip[j].isdigit():
count_str += s_zip[i]
print(s_out)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question