Perpendicular distance between a point and a Line in 2 D | Python program to find the distance between a given point and a given line in 2 D . ; Function to find distance ; Driver Code
import math NEW_LINE def shortest_distance ( x1 , y1 , a , b , c ) : NEW_LINE INDENT d = abs ( ( a * x1 + b * y1 + c ) ) / ( math . sqrt ( a * a + b * b ) ) NEW_LINE print ( " Perpendicular ▁ distance ▁ is " ) , d NEW_LINE DEDENT x1 = 5 NEW_LINE y1 = 6 NEW_LINE a = - 2 NEW_LINE b = 3 NEW_LINE c = 4 NEW_LINE shortest_distance ( x1 , y1 , a , b , c ) NEW_LINE