Real Python Tutorials

Using and Creating Global Variables in Your Python Functions
NEW

Working With Global Variables in Python Functions

In this video course, you'll learn how to use global variables in Python functions using the global keyword or the built-in globals() function. You'll also learn a few strategies to avoid relying on global variables because they can lead to code that's difficult to understand, debug, and maintain.

Apr 30, 2024 intermediate best-practices python