python what is a global variable code example Example 1: global variables python global x x=1 Example 2: how to declare global variable in python global n n = 'whatever'