9951 explained code solutions for 126 technologies


pythonHow to declare global variable


var = 1

def fnc():
  global var
  # do something with varctrl + c
var

declare variable to be used as global and assign value

global var

declares var as global variable - now can be used in function