fork(5) download
  1. def setcake(taste):
  2. global cake
  3. cake = taste
  4. def caketaste():
  5. print cake #Output is whatever taste was
  6.  
  7. caketaste()
Runtime error #stdin #stdout #stderr 0.01s 7724KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 7, in <module>
    caketaste()
  File "prog.py", line 5, in caketaste
    print cake #Output is whatever taste was
NameError: global name 'cake' is not defined