Think about it. Does p EVER change? Why not? How would you make it change?
Inside the loop, we see only this:
p starts out as whatever number is it. Does it EVER change? (NO.)
When you do this:
Here, I think you think this evaluates the FUNCTION every time. It does not. p is a number. It sets F to be the number p.
Therefore, p_0 = p. ALWAYS. Now, what does your test do? It terminates the loop when p0-p is a small enough number. Zero certainly satisfies the requirement. So the loop runs for one iteration, then quits.
So, change your code to re-evaluate the function inside F. Do not overwrite the variable F.