Getting ready

We can declare module-level globals in any module just above and outside functions.

We then have to use the global Python keyword to refer to them. If we forget to use global in functions, we will accidentally create new local variables. This would be a bug and something we really do not want to do.

Python is a dynamic, strongly typed language. We will notice bugs such as this (forgetting to scope variables with the global keyword) only at runtime.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.163.229