human
Check if it is possible to reach destination in even number of steps in an Infinite Matrix | Function to check destination can be reached from source in even number of steps.
Coordinates differences.
Minimum number of steps required.
Minsteps is even.
Minsteps is odd.
Driver Code.
Given Input.
Function Call"
How can the above be solved in Python?
assistant
#Here is code to check if it is possible to reach destination in even number of steps in an Infinite Matrix and the other steps required.
 def IsEvenPath ( Source , Destination ) :
	x_dif = abs ( Source [ 0 ] - Destination [ 0 ] )
	y_dif = abs ( Source [ 1 ] - Destination [ 1 ] )
	minsteps = x_dif + y_dif
	if ( minsteps % 2 == 0 ) :
		print ( " Yes " )
	else :
		print ( " No " )
if __name__ == ' _ _ main _ _ ' :
	Source = [ 2 , 1 ]
	Destination = [ 1 , 4 ]
	IsEvenPath ( Source , Destination )