CPSC120B
Fundamentals of Computer Science I

Post-lab 12

Fruitful Functions

Write a Python function distance(x1, y1, x2, y2) that returns the distance between the specified two-dimensional points, (x1, y1) and (x2, y2). The distance, \(d\), between two points can be calculated with the equation:

$$d = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}$$