I need to build a python code for the following equation.
As I understood this equation has only 4 iterations and until it becomes true need to recall the function again. But when recalling the function the value which use to store the number of iterations will be lost.
The code which I have write is this.
def answer(z):
for i in 5:
if i == 4:
zn = z + 1/z
else:
y = 1 / z + zn
return y
z = float(input("Enter value for Z : "))
print("The Y Value is : %.4f" %answer(z))
I need to know to build the code for this equation.