Sometimes, while in competitive programming, we might be facing a problem which is of geometry domain and works with x-y coordinate system. The list of tuple can be used to store the same. And along with this, there might be a problem in which we need point with max value of x axis with similar y axis i.e farthest point on horizontal lines. Let’s discuss certain ways to discuss this problem.
Method : Using list comprehension +
This is a generic brute force method applied to get the max x axis point for common y axis, made as 1 liner using list comprehension. The
max() is used to find the max of x axis element.
The original list is : [(1, 6), (4, 6), (2, 6), (6, 8), (1, 8), (2, 9)] The list after filtering just maximum points on lines : [(4, 6), (6, 8), (2, 9)]
- Python Program for Number of jump required of given length to reach a point of form (d, 0) from origin in 2D plane
- Python - Convert simple lines to bulleted lines using the Pyperclip module
- Python | Sympy Plane.perpendicular_plane() method
- Python | Sympy Plane.projection_line() method
- Python | Sympy Plane.projection() method
- Python | Sympy Plane.is_coplanar() method
- Python | Sympy Plane.are_concurrent() method
- Python | Sympy Plane.equation() method
- Python | Sympy Plane.parallel_plane() method
- Python - Reading last N lines of a file
- Python program to copy odd lines of one file to other
- matplotlib.lines.VertexSelector class in Python
- Python Desktop News Notifier in 20 lines
- Count number of lines in a text file in Python
- Python Tkinter | Create different type of lines using Canvas class
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.