
    Design a function that analyzes patient movement patterns by counting matching pairs of location transitions, where each pair represents a complete round trip between two points (e.g., bedroom-bathroom and bathroom-bedroom counts as one bidirectional pair). The function should process a list of recorded patient movements, where each movement is represented as a tuple containing the starting and ending locations, and identify the total number of complete bidirectional movement patterns to help assess regular patient routines and potential fall risks.
    

    
def count_bidirectional(test_list):
    """
    Design a function that analyzes patient movement patterns by counting matching pairs of location transitions, where each pair represents a complete round trip between two points (e.g., bedroom-bathroom and bathroom-bedroom counts as one bidirectional pair). The function should process a list of recorded patient movements, where each movement is represented as a tuple containing the starting and ending locations, and identify the total number of complete bidirectional movement patterns to help assess regular patient routines and potential fall risks.
    

    """
def count_bidirectional(test_list):
    """
    Design a function that analyzes patient movement patterns by counting matching pairs of location transitions, where each pair represents a complete round trip between two points (e.g., bedroom-bathroom and bathroom-bedroom counts as one bidirectional pair). The function should process a list of recorded patient movements, where each movement is represented as a tuple containing the starting and ending locations, and identify the total number of complete bidirectional movement patterns to help assess regular patient routines and potential fall risks.
    

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