human
Check if two people starting from different points ever meet | Python3 program to find if two people starting from different positions ever meet or not ..
If speed of a person at a position before other person is smaller , then return false ..
Making sure that x1 is greater.
Until one person crosses other.
first person taking one jump in each iteration.
second person taking one jump in each iteration.
Driver code"
How can the above be solved in Python?
 Write me a code to check if two people starting from different points ever meet and the other steps required?
assistant
#Here is code to check if two people starting from different points ever meet and the other steps required.
 def everMeet ( x1 , x2 , v1 , v2 ) :
	if ( x1 < x2 and v1 <= v2 ) :
		return False ;
	if ( x1 > x2 and v1 >= v2 ) :
		return False ;
	if ( x1 < x2 ) :
		x1 , x2 = x2 , x1 ;
		v1 , v2 = v2 , v1 ;
	while ( x1 >= x2 ) :
		if ( x1 == x2 ) :
			return True ;
		x1 = x1 + v1 ;
		x2 = x2 + v2 ;
	return False ;
x1 = 5 ;
v1 = 8 ;
x2 = 4 ;
v2 = 7 ;
if ( everMeet ( x1 , x2 , v1 , v2 ) ) :
	print ( " Yes " ) ;
else :
	print ( " No " ) ;