On this page
  1. math.dist
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

math.dist

Prev: math.degrees | Up: math | Next: math.erf
Rel: math.acos, math.acosh, math.asin, math.asinh
Ref: docs.python.org — math.dist
Tags: #public #python3 #stdlib #math


Import

import math
from math import dist

Signature & Overview

math.dist(p, q, /)

Return the Euclidean distance between two points p and q.

Usage

import math

assert math.isclose(math.dist((0, 0), (3, 4)), 5.0)
assert math.isclose(math.dist([1, 2, 3], [4, 6, 3]), 5.0)

Gotchas

REPL Inspect

from math import dist
help(dist)

Linked from

Related notes