Home / Python Tips Generated By ChatGPT / Understanding the global Keyword in Python Use global to modify a global variable inside a function. Source Code counter = 0 def increment(): global counter counter += 1