Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to use global keyword in python

name = "Abdullah" # creates global variable

def func():
  global name # calls the name variable from global scope
  
  name = "Kemal" # Changes name variable

func()
print(name) # global name variable will be changed because of the global keyword
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #global #keyword #python
ADD COMMENT
Topic
Name
3+9 =