title: How can I find the indices of any two of the numbers, whose sum is equal to the target sum in Python?
body: <p>I'm doing this test on testdome.com for practicing , and it's failing some test case. Can anyone help me pointing out the logic error in my code?</p>
  
  <p>This is the question for my code: </p>
  
  <p>"Write a function that, when passed a list and a target sum, returns, efficiently with respect to time used, two distinct zero-based indices of any two of the numbers, whose sum is equal to the target sum. </p>
  
  <p>If there are no two numbers, the function should return <code>None</code>.</p>
  
  <p>For example, <code>find_two_sum([3, 1, 5, 7, 5, 9], 10)</code> should return a single tuple containing any of the following pairs of indices:</p>
  
  <ul>
  <li>0 and 3 (or 3 and 0) because addition of 3 and 7 is 10.</li>
  <li>1 and 5 (or 5 and 1) because addition of 1 and 9 is 10.</li>
  <li>2 and 4 (or 4 and 2) because addition of 5 and 5 is 10.</li>
  </ul>
  
  <pre class="lang-py prettyprint-override"><code>def find_two_sum(numbers, target_sum):
      sss=list(dict.fromkeys(numbers))
      if (sss == None or len(sss) &lt; 2): return None
  
      for item in sss:
          tesn=target_sum-item
          if tesn in sss: 
              if numbers.index(item)==numbers.index(tesn):
                  continue
              else:
                  return numbers.index(item),numbers.index(tesn)
      return None
  print(find_two_sum([3, 1, 5, 7, 5, 9], 10))
  </code></pre>
  
  <p>They have four test cases and my code can only pass first two test cases.</p>
  
  <p>Example case:Wrong answer ( to return [0,2] because 3 of index 0 + 7 of index  3 is 10) <br>
  Distinct numbers with and without solutions: Wrong answer <br>
  Duplicate numbers with and without solutions: Wrong answer  <br>
  Performance test with a large list of numbers: Wrong answer <br></p>