title: Returning the numbers in a list whose sum is a given target
body: <pre><code>input = x[1,2,4,6,3,9]
  target = 6
  </code></pre>
  
  <p>o/p:
  the first number is 1 and the second number is 5</p>
  
  <p>I came across this problem and I solved it using this code:</p>
  
  <pre><code>def search(a,b):
      for d in b:
          if a==d:
              m=True
              break
          else:
              m=False
      return m
  
  x=[1,4,5,7,9,6,2]
  target=int(raw_input("Enter the number:"))
  for i in x:
      if i&lt;target:
          pair=int(target)-int(i)
          in2=search(pair,x)
          if in2==True:
              print "the first number= %d the second number %d"%(i,pair)
              break
  </code></pre>
  
  <p>How can I do this better or in a more efficient manner?</p>