
    Design a function that analyzes student mastery patterns by counting unique bidirectional level transitions in their learning path, where a bidirectional transition means a student has successfully moved between two difficulty levels in both directions. Given a list of completed level transitions where each transition is represented as a tuple of two difficulty levels, determine how many unique bidirectional transitions exist in the student's learning journey.
    

    
def count_bidirectional(test_list):
    """
    Design a function that analyzes student mastery patterns by counting unique bidirectional level transitions in their learning path, where a bidirectional transition means a student has successfully moved between two difficulty levels in both directions. Given a list of completed level transitions where each transition is represented as a tuple of two difficulty levels, determine how many unique bidirectional transitions exist in the student's learning journey.
    

    """
def count_bidirectional(test_list):
    """
    Design a function that analyzes student mastery patterns by counting unique bidirectional level transitions in their learning path, where a bidirectional transition means a student has successfully moved between two difficulty levels in both directions. Given a list of completed level transitions where each transition is represented as a tuple of two difficulty levels, determine how many unique bidirectional transitions exist in the student's learning journey.
    

    """
    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 res