AI engineering glossary · Python core
What is global keyword?
global keyword: A statement that declares a name inside a function to refer to the module-level variable, so that assignments change the global instead of creating a local. Overuse makes code hard to follow.
global keyword: an example
count = 0; def inc(): global count; count += 1 raises the module's count; without global it raises UnboundLocalError.
Related terms
More Python core terms
Where you learn it
global keyword is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.