human
Find Cube Pairs | Set 1 ( A n ^ ( 2 / 3 ) Solution ) | Function to find pairs that can represent the given number as sum of two cubes.
Find cube root of n.
Create an empty map.
Consider all pairs such with values less than cuberoot.
Find sum of current pair ( x , y ).
Do nothing if sum is not equal to given number.
If sum is seen before , we found two pairs.
If sum is seen for the first time.
Driver code"
How can the above be solved in Python?
 Write me a code to find Cube Pairs and the other steps required?
assistant
#Here is code to find Cube Pairs and the other steps required.
 def findPairs ( n ) :
	cubeRoot = pow ( n , 1.0 / 3.0 ) ;
	s = { }
	for x in range ( int ( cubeRoot ) ) :
		for y in range ( x + 1 , int ( cubeRoot ) + 1 ) :
			sum = x * x * x + y * y * y ;
			if ( sum != n ) :
				continue ;
			if sum in s . keys ( ) :
				print ( " ( " + str ( s [ sum ] [ 0 ] ) + " , ▁ " + str ( s [ sum ] [ 1 ] ) + " ) ▁ and ▁ ( " + str ( x ) + " , ▁ " + str ( y ) + " ) " +   " " )
			else :
				s [ sum ] = [ x , y ]
if __name__ == " _ _ main _ _ " :
	n = 13832
	findPairs ( n )