# Python | Sympy Line.distance() method

• Last Updated : 10 Feb, 2020
In Sympy, the function `distance()` is used to find the shortest distance between a given line and a given point.
```Syntax: Line.distance(other)

Parameter:
other: a point

Returns: shortest distance between a line and a point

Raises: NotImplementedError is raised if `other` is not a Point
```

Example #1:

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

 `# import sympy and Point, Line ``from` `sympy ``import` `Point, Line `` ` `p1, p2 ``=` `Point(``0``, ``0``), Point(``1``, ``1``)``s ``=` `Line(p1, p2)`` ` `# using distance() method``shortestDistance ``=` `s.distance(Point(``-``1``, ``1``))`` ` `print``(shortestDistance)`

Output:

`sqrt(2)`

Example #2:

 `# import sympy and Point, Line ``from` `sympy ``import` `Point, Line `` ` `p1, p2 ``=` `Point(``0``, ``0``, ``0``), Point(``1``, ``1``, ``1``)``s ``=` `Line(p1, p2)`` ` `# using distance() method``shortestDistance ``=` `s.distance(Point(``-``1``, ``1``, ``1``))`` ` `print``(shortestDistance)`

Output:

`2*sqrt(6)/3`

My Personal Notes arrow_drop_up