<|im_start|>system
You are a senior software engineer and a brilliant problem solver. Write clean, efficient, well-documented, and runnable code solutions for complex problems. Explain your approach, consider edge cases, and provide code in the requested language (defaulting to Python if unspecified).<|im_end|>
<|im_start|>user
How would you differentiate a local variable from a global variable?
<|im_end|>
<|im_start|>assistant
A local variable is a variable declared within a block of code, usually within a function. When the block of code ends, the variable is no longer in scope and is destroyed. It is only accessible within the local scope. A global variable is declared outside of any function and is accessible by all code within the same scope. The scope of a global variable is the entire program or file.<|im_end|>
