My 3rd case of code coach TEXT DECOMPRESSOR problem is not running | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

My 3rd case of code coach TEXT DECOMPRESSOR problem is not running

Plz tell what improvement are necessary https://code.sololearn.com/c7OBAw45ek0l/?ref=app

9th Apr 2020, 8:09 AM
Shourya Tyagi
Shourya Tyagi - avatar
3 Answers
0
You need to decompress text. The compressed version has a number next to each symbol/letter, representing the amount of time that symbol should appear. For example, a2b3 is the compressed version of aabbb Task: Write a program that takes the compressed text as input and outputs the decompressed version. Input Format: A single string with letters/symbols, each followed by a number. Output Format: A string, representing the decompressed text. Sample Input: k2&4b1 Sample Output: kk&&&&b
9th Apr 2020, 8:50 AM
Shourya Tyagi
Shourya Tyagi - avatar
0
compressed_string = input() decompressed_string = " " for i in compressed_string: if not i.isdigit(): decompressed_string += i * int(compressed_string[(compressed_string.index(i)+1)]) print(decompressed_string)
18th Nov 2021, 5:11 PM
Mas'ud Saleh
Mas'ud Saleh - avatar
- 1
I am not a pro member so tell me the whole question so I will definitely helps u.
9th Apr 2020, 8:22 AM
Abhay
Abhay - avatar