Code demonstration of using global statements in Python functions

From , 5 Years ago, written in Python, viewed 209 times.
URL https://pastebin.vip/view/56d33021
  1. #!/usr/bin/python
  2. # Filename: func_global.py
  3.  
  4. def func():
  5.     global x
  6.  
  7.     print 'x is', x
  8.     x = 2
  9.     print 'Changed local x to', x
  10.  
  11. x = 50
  12. func()
  13. print 'Value of x is', x
  14.  
  15.  
  16.  

Reply to "Code demonstration of using global statements in Python functions"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website