how to make local a variable global in python

Solutions on MaxInterview for how to make local a variable global in python by the best coders in the world

showing results for - "how to make local a variable global in python"
Abigail
03 Jun 2019
1# If you use the global keyword, the variable belongs to the global scope:
2  
3  def myfunc():
4  global x
5  x = "fantastic"
6
7myfunc()
8
9  
10print("Python is " + x)