Gobal Variable Error

When I try to submit
This error shows “Grader found global variables inside graded fuctions. Please avoid using global variables in your functions.”

What should I do?

Hi @Pirzada

If you have local variable named embeddings then do not use global variable named word_embeddings. (Here is a Video what is being meant by global vs. local variables and the playground to experiment.)

In other words, you have to check your variable use.


And the reason this matters is that the grader executes each graded function on its own in a new context. That is, your notebook as a whole isn’t executed…just the graded portions, one at a time, separately. So you can’t (even unintentionally) use anything out of scope of a specific graded function.