def nthRoot(n,x):
    """ Returns the nth root of a number """

    seq_start = 1.0         #sequence starting value 
    counter = 0             #initialize the generator counter to zero 

    if x < 0:
        raise ValueError,\
            " Cannot compute a Square root on a negative number"
    elif n == 0:
        raise ValueError,\
            " Cannot compute 0 root of a number"
    
    while counter < 700:
            
        yield seq_start     #return nthRoot(x)
        
        #compute the next sequence term (Xn+1)    
        seq_start = 1/float(n) * ((n-1)*float(seq_start )+ x/(float(seq_start)**(n-1)))
        
        
        counter += 1
 Returns the nth root of a number 
recipes/Python/576857_nthRoot/recipe-576857.py