Maximum distinct lines passing through a single point | Python3 program to find maximum number of lines which can pass through a single point ; function to find maximum lines which passes through a single point ; Driver Code
import sys NEW_LINE def maxLines ( n , x1 , y1 , x2 , y2 ) : NEW_LINE INDENT s = [ ] ; NEW_LINE slope = sys . maxsize ; NEW_LINE for i in range ( n ) : NEW_LINE INDENT if ( x1 [ i ] == x2 [ i ] ) : NEW_LINE INDENT slope = sys . maxsize ; NEW_LINE DEDENT else : NEW_LINE INDENT slope = ( y2 [ i ] - y1 [ i ] ) * 1.0 / ( x2 [ i ] - x1 [ i ] ) * 1.0 ; NEW_LINE DEDENT s . append ( slope ) ; NEW_LINE DEDENT return len ( s ) ; NEW_LINE DEDENT n = 2 ; NEW_LINE x1 = [ 1 , 2 ] ; NEW_LINE y1 = [ 1 , 2 ] ; NEW_LINE x2 = [ 2 , 4 ] ; NEW_LINE y2 = [ 2 , 10 ] ; NEW_LINE print ( maxLines ( n , x1 , y1 , x2 , y2 ) ) ; NEW_LINE