Hi @srilika and welcome to the DL Specialization! The NameError indicates that the sigmoid(...) function that you wrote earlier in the notebook, is not available in the “namespace”. That is, Python cannot find it. So first be sure that you completed that function, and importantly, run it and check that it passes. By running that cell, Python will recognize the existence of the function.
Great! The important thing to realize is that @kenb’s point there is a completely general one: every time you close and reopen the notebook or restart the “Kernel”, you need to rerun all the previous cells in the notebook to populate the “namespace” that Ken described. It looks misleading when you open the notebook, because you see all the printed output from the last time you run things. But the point is that the “runtime state” in memory (the “namespace”) is not populated and needs to be recreated every time. There is a topic about this on the FAQ Thread, which is worth a look just on general principles.