Sobes.tech
Junior — Senior

Finding the vertical axis of symmetry of a set of points

livecode

Task condition

Given a set of points on a 2D plane (a list of coordinate pairs). It is required to determine whether there exists a vertical line about which the set of points is symmetric, and if such a line exists, return its x-coordinate.

def symmetry():
    pass

Example usage:

  • points = [(-4, 2), (4, 2), (3, 3), (-3, 3)] → result: 0
  • points = [(-4, 2), (4, 3), (3, 3), (-3, 3)] → result: None