venture of iit bombay vjti alumni total sum )print "outside the function "total when the above code is executedit produces the following result inside the function outside the function scope of variables all variables in program may not be accessible at all locations in that program this depends on where you have declared variable the scope of variable determines the portion of the program where you can access particular identifier there are two basic scopes of variables in python global variables local variables global vs local variables variables that are defined inside function body have local scopeand those defined outside have global scope