Math module in Python contains a number of mathematical operations, which can be performed with ease using the module.
math.dist() method in Python is used to the Euclidean distance between two points p and q, each given as a sequence (or iterable) of coordinates. The two points must have the same dimension.
This method is new in Python version 3.8.
Syntax: math.dist(p, q)
p: A sequence or iterable of coordinates representing first point
q: A sequence or iterable of coordinates representing second point
Returns: the calculated Euclidean distance between the given points.
Code #1: Use of
Reference: Python math library
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