human
Check whether triangle is valid or not if three points are given | Function to check if three points make a triangle.
Calculation the area of triangle . We have skipped multiplication with 0.5 to avoid floating point computations.
Condition to check if area is not equal to 0.
Driver code"
How can the above be solved in Python?
 ... Write me a code to check whether triangle is valid or not if three points are given and the other steps required?
assistant
#Here is code to check whether triangle is valid or not if three points are given and the other steps required.
 def checkTriangle ( x1 , y1 , x2 , y2 , x3 , y3 ) :
	a = ( x1 * ( y2 - y3 ) + x2 * ( y3 - y1 ) + x3 * ( y1 - y2 ) )
	if a == 0 :
		print ( ' No ' )
	else :
		print ( ' Yes ' )
if __name__ == ' _ _ main _ _ ' :
	( x1 , x2 , x3 ) = ( 1 , 2 , 3 )
	( y1 , y2 , y3 ) = ( 1 , 2 , 3 )
	checkTriangle ( x1 , y1 , x2 , y2 , x3 , y3 )