Question: 
Write a function to count bidirectional tuple pairs.


Model's Code:
def count_bidirectional(tuples):
    count = 0
    seen = set()
    for a, b in tuples:
        if (b, a) in seen:
            count += 1
        seen.add((a, b))
    return str(count)



Sample Correct Code:
def count_bidirectional(test_list):
  res = 0
  for idx in range(0, len(test_list)):
    for iidx in range(idx + 1, len(test_list)):
      if test_list[iidx][0] == test_list[idx][1] and test_list[idx][1] == test_list[iidx][0]:
        res += 1
  return (str(res)) 


Asserts:
assert count_bidirectional([(5, 6), (1, 2), (6, 5), (9, 1), (6, 5), (2, 1)] ) == '3'
assert count_bidirectional([(5, 6), (1, 3), (6, 5), (9, 1), (6, 5), (2, 1)] ) == '2'
assert count_bidirectional([(5, 6), (1, 2), (6, 5), (9, 2), (6, 5), (2, 1)] ) == '4'


Tests:
Test 1 of 3: PASS
Test 2 of 3: PASS
Test 3 of 3: FAIL: AssertionError()

Test 438 of 974: 319/438 (72.8310502283105%): failed