Global variables can be accessed inside and outside functions. Local variables declared inside a function are only accessible within the function. Nonlocal variables are used in nested functions and are neither local nor global. The global keyword allows modifying global variables from within a function by declaring them global. Without global, local variables with the same name as global variables are created. Global variables can be accessed and modified in nested functions using global.