0

guys i am new in python and for some reason the word global not working for me ex

def location():  
global place
place = "Cape Town"
return

and when i am trying to print place

print(place)

i am facing that error

 NameError                                 Traceback (most recent call last)
<ipython-input-2-34a3a4594339> in <module>()
----> 1 print(place)

NameError: name 'place' is not defined

0 Answers0