I have two functions for newtons method to estimate roots of a number that the user inputs, but I am tasked with "packaging these functions into a module". I admit I am struggling to wrap my head around the concept of modules and can't really find any material that helps me.
Have tried saving the functions separately as two different files and using the import command but can't seem to find any success.
[Edit] Trying to get the previous_x to not display once the final estimation established.
[Edit2] Still "None" appears for previous_x
def newtons_fourth(y): x=1 N=0 previous_x = None while N < 50: x=1/4*(3*(x) + y/(x**3)) N=N+1 print('Iteration number:',N) print('Estimation:',x) print('Previous x:',previous_x) print() if previous_x is not None: if abs(x - previous_x) < 0.0001: final=1 print('Difference negligible') print('Final Estimation:',x) break previous_x = x if final!=1: return previous_x