title: converting string to tuple
body: <p>I need to write a function that takes a string '(1,2,3,4,5),(5,4,3,2,1)' and returns a list of tuples of the 1st and last element of each tuple, [(1,5),(5,1)].
  I was thinking:</p>
  
  <pre><code>def f(givenstring):
      a=givenstring.split(',')
      for i in a[0:-1]:
          tuple(int(i[0,-1]))
  </code></pre>
  
  <p>but here I'm stucked..</p>