logo

Your Questions / Our Solutions


Jese Leos

Helpdice Team

What are local variables and global variables in Python?

<p><strong>Global Variables:</strong></p> <p>Variables declared outside a function or in global space are called global variables. These variables can be accessed by any function in the program.</p> <p><strong>Local Variables:</strong></p> <p>Any variable declared inside a function is known as a local variable. This variable is present in the local space and not in the global space.</p>
  • Share On: