Knowee
Questions
Features
Study Tools

Symmetric pairsExtract all the pairs which are symmetric, i.e for any (x, y), we have (y, x) pair presentConstraints:NAExample:Input :36 72 37 6Output : (6, 7)

Question

Symmetric Pairs

Extract all the pairs which are symmetric, i.e for any (x, y), we have (y, x) pair present.

Constraints: NA

Example:
Input:
36 72 37 6
Output:
(6, 7)

🧐 Not the exact question you are looking for?Go ask a question

Solution

It seems like there is a misunderstanding in the question. The example provided does not match the problem statement.

However, I can provide a general solution for the problem statement: "Extract all the pairs which are symmetric, i.e for any (x, y), we have (y, x) pair present".

Here is a Python solution:

def find_symmetric_pairs(lst):
    # Create an empty set to store pairs
    pairs = set()

    # Create an empty list to store symmetric pairs
    symmetric_pairs = []

    # Iterate over each pair in the list
    for pair in lst:
        # Create a reversed version of the current pair
        reversed_pair = tuple(reversed(pair))

        # If the reversed pair is in the set of pairs, add it to the list of symmetric pairs
        if reversed_pair in pairs:
            symmetric_pairs.append(pair)

        # Add the current pair to the set of pairs
        pairs.add(tuple(pair))

    return symmetric_pairs

You can use this function like this:

pairs = [(1, 2), (2, 1), (3, 4), (5, 6)]
print(find_symmetric_pairs(pairs))

This will output:

[(2, 1)]

This means that the pair (2, 1) is symmetric to (1, 2).

This problem has been solved

Similar Questions

Symmetric pairsExtract all the pairs which are symmetric, i.e for any (x, y), we have (y, x) pair presentConstraints:NAExample:Input :36 72 37 6Output : (6, 7)

Determine whether the Relation R in the set A=1,2,3,4,5,6 as R={(x,y):yisdivisiblebyx}  is reflexive, symmetric and transitiveHard

Find a relation between x and y, such that the point (x, y) is equidistant from the points (3,6) and (-3,4)

Given Binary Tuple representing  binary representation of number, convert to integer.Constraints:NAExample:Input:1 1 0Output :6

Which of the following functions will return the symmetric difference between two sets, x and y?x | yx ^ yx & yx – y

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.