how to remove elements from a list of strings while traversing through it. I have a list
list1 = ['', '$', '32,324', '$', '32', '$', '(35', ')', '$', '32,321']
i want to remove $ fro the list and if a ) or )% or % comes add that to the previous elemt of the list.
expected output is :
['', '32,324', '32', '(35)', '32,321']
what i have tried is
for j,element in enumerate(list1):
   if element == '%' or element == ")%" or element ==')':
      list1[j-1] = list1[j-1] + element
      list1.pop(j)
   elif element == '$':
      list1.pop(j)
but the output i am getting is
['', '32,324', '32', '(35)', '$', '32,321']
whis is not the expected output. Please help
This question is different from the suggested reference is, here I have to do a concatenation with the previous element if the current element is ),)% or %.
 
     
     
    