Text Decompression. One of my test cases failed
This is the first medium difficulty challenge I have done and although I have probably done it in the most convoluted and messy way possible, I feel somewhat accomplished in that I have at least passed most of the test cases. My questions are, how could my code be tidied up, and how could I make sure the final test case also passed? txt=input() def split(txt): return[char for char in txt] def num(lst): nums=[] letts=[] for x in lst: if x.isdigit()==True: nums.append(x) else: letts.append(x) for i in range(0, len(nums)): nums[i]=int(nums[i]) zip1=zip(letts, nums) dict1=dict(zip1) return(dict1) def decom(y): fin="" for key in y: fin+=(key*y[key]) return(fin) print(decom(num(split(txt))))