Program to find slope of a line | Python3 program to find slope ; Function to find the slope of a straight line ; Driver code
import sys NEW_LINE def slope ( x1 , y1 , x2 , y2 ) : NEW_LINE INDENT if x1 == x2 : NEW_LINE INDENT return ( sys . maxsize ) NEW_LINE DEDENT return ( ( y2 - y1 ) / ( x2 - x1 ) ) NEW_LINE DEDENT x1 = 4 NEW_LINE y1 = 2 NEW_LINE x2 = 2 NEW_LINE y2 = 5 NEW_LINE print ( " Slope ▁ is ▁ : " , slope ( 4 , 2 , 2 , 5 ) ) NEW_LINE