distance(x1, y1, x2, y2) that returns the Euclidean distance between points (x1, y1) and (x2, y2), rounded to 2 decimal places. Then, given two point tuples p1 and p2, call distance by unpacking both tuples with the * operator in a single call such as distance(*p1, *p2).p1 = (0, 0) p2 = (3, 4) distance(*p1, *p2)
5.0
The classic 3-4-5 right triangle distance.
distance((x2-x1)**2 + (y2-y1)**2) ** 0.5 is the formula, before rounding.
Unpacking a tuple with *p1 inside a call spreads its elements as separate positional arguments.