#find the cube root of perfect cube int(raw_input('enter an integer')for ans in range( abs( )+ )if ans** >abs( )break if ans** !abs( )print 'is not perfect cubeelseif ans -ans print 'cube root of' ,'is'ans figure using for and break statements the for statement can be used to conveniently iterate over characters of string for exampletotal for in ' 'total total int(cprint total sums the digits in the string denoted by the literal ' and prints the total finger exerciselet be string that contains sequence of decimal numbers separated by commase ' , , write program that prints the sum of the numbers in approximate solutions and bisection search imagine that someone asks you to write program that finds the square root of any nonnegative number what should you doyou should probably start by saying that you need better problem statement for examplewhat should the program do if asked to find the square root of the square root of is not rational number this means that there is no way to precisely represent its value as finite string of digits (or as float)so the problem as initially stated cannot be solved the right thing to have asked for is program that finds an approximation to the square root-- an answer that is close enough to the actual square root to be useful we will return to this issue in considerable detail later in the book but for nowlet' think of "close enoughas an answer that lies within some constantcall it epsilonof the actual answer the code in figure implements an algorithm that finds an approximation to square root it uses an operator+=that we have not previously used the code ans +step is semantically equivalent to the more verbose code ans ans+step the operators -and *work similarly