O'Reilly logo

Python Without Fear, First Edition by Brian Overland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10. Local and Global Variables

One of the issues in programming is communication—how do you share information between two functions or between a group of functions? The most direct way is to use global variables.

But Python has idiosyncratic rules about global and local variables. Python likes to do things its own way.

This chapter covers

Image The difference between local and global variables

Image The global keyword

Image Using this keyword to prevent “the local ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required