title: How to insert character into a list before specific character from the end of the list and the same after last character?
body: <p>I have a generated list for simple calculator.
  It looks like this for example: </p>
  
  <pre><code>l = [1,5, +, 2, 7, *, 3, 5, - , 9, 5, +, 4,5,6]
  </code></pre>
  
  <p>And in the input line it will be looking like this  "15 + 27 * 35 - 95 + 456". </p>
  
  <p>What I need to do is to implement a function which makes last entry negative and in parentheses (-456) ( not last digit 6, but all digits after non digit character from the end of the list)</p>
  
  <p>So I have a list </p>
  
  <pre><code>list = [1,5, +, 2, 7, *, 3, 5, -, 9, 5, +, 4, 5, 6]
  </code></pre>
  
  <p>And I need to insert parentheses after "+" from the end, then "-", then 4,5,6, then parentheses again. 
  So my new list should look like this:</p>
  
  <pre><code>list2 = [1, 5, +, 2, 7, *, 3, 5, - , 9, 5, +, (,-,4,5,6,)] 
  </code></pre>
  
  <p>Basically I need to find non digit character from the end, insert two characters "(", "-", then add ")" after last digit. </p>
  
  <p>How can I do this? </p>
  
  <p>then I'll apply this function  ''.join(map(str,list)) and it will look like this  "15 + 27 * 35 - 95 + (-456)" </p>
  
  <p>I've tried to use regex, but seems like I've failed :-(  </p>
  
  <p>thanks</p>