Aug-04-2017, 04:23 PM
Thanks guys, as you advised I assigned the variable inside that second function and I put a while loop after that, and it worked.
def main(): number = int(input("Insert the number:")) if number == "": print("Goodbye!") elif number < 0: print("Error: negative number") else: def estim(someNumber): estimation = 1 while True: estimation = (estimation + someNumber / estimation) / 2 tollerance = 0.000000001 difference = abs(number - estimation **2) if difference <= tollerance: break return estimation return estim(number)