Course Recommendation:

Python global keyword

Example

Ideclare ang global variable sa loob ng function, at gamitin ito sa labas ng function:
# Create function:
  def myfunction():
  global x
x = "hello"
# Execute function:
myfunction()
# x ngayon ay global variable, maaring ma-access global.

print(x)

Run Example

Definition and Usage