Sort by the distance from multiple points to one point

how to write the red circle

Mar.17,2021

from functools import partial
import math

points = [(1, 2), (3, 4), (5, 6), (7, 8)]
pt = (4, 3)

def distance(p1, p2):
    return math.hypot(p1[0] - p2[0], p1[1] - p2[1])

points.sort(key=partial(distance, pt))

there is no need to use partial functions

points.sort(key=lambda i: math.hypot(i[0] - pt[0], i[1] - pt[1])) -sharplambda

and list.sort has no return value. If you write and print like that, None, newlist = sorted (list) is the one with return value

.

you can write so much that you can't write the red circle.
x1, y1 = p1
x2, y2 = p2

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4b9cc-44e3a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4b9cc-44e3a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?