Posts

Showing posts with the label variables

Python Local & Global Variables

Image
   Concept Global variables are the ones that are defined and declared outside a function and we need to use them inside a function. Code Example 1: def foo(): total = 1           return total total = 0 print(foo()) >>> 1 Example 2: def fun():           print(s) s = "Hello World" fun() >>> Hello World Get Help