human
Give me a code to find cubic root of a number and the other steps required given the following:
Find cubic root of a number | Returns the absolute value of n - mid * mid * mid.
Returns cube root of a no n.
Set start and end for binary search.
Set precision.
If error is less than e then mid is our answer so return mid.
If mid * mid * mid is greater than n set end = mid.
If mid * mid * mid is less than n set start = mid.
Driver code"
Solution in Python:
assistant
#Here is code to find cubic root of a number and the other steps required.
 def diff ( n , mid ) :
	if ( n > ( mid * mid * mid ) ) :
		return ( n - ( mid * mid * mid ) )
	else :
		return ( ( mid * mid * mid ) - n )
def cubicRoot ( n ) :
	start = 0
	end = n
	e = 0.0000001
	while ( True ) :
		mid = ( start + end ) / 2
		error = diff ( n , mid )
		if ( error <= e ) :
			return mid
		if ( ( mid * mid * mid ) > n ) :
			end = mid
		else :
			start = mid
n = 3
print ( " Cubic ▁ root ▁ of " , n , " is " , round ( cubicRoot ( n ) , 6 ) )