human
Give me a code to number of triangles formed from a set of points on three lines and the other steps required given the following:
Number of triangles formed from a set of points on three lines | Returns factorial of a number.
calculate c ( n , r ).
Driver code"
How can the above be solved in Python?
assistant
#Here is code to number of triangles formed from a set of points on three lines and the other steps required.
 def factorial ( n ) :
	fact = 1
	for i in range ( 2 , n + 1 ) :
		fact = fact * i
	return fact
def ncr ( n , r ) :
	return ( factorial ( n ) // ( factorial ( r ) * factorial ( n - r ) ) )
if __name__ == " _ _ main _ _ " :
	m = 3
	n = 4
	k = 5
	totalTriangles = ( ncr ( m + n + k , 3 ) - ncr ( m , 3 ) - ncr ( n , 3 ) - ncr ( k , 3 ) )
	print ( totalTriangles )