fork(1) download
  1. #!/bin/python
  2. from functools import reduce
  3. import sys
  4.  
  5. def adder(the_dict):
  6. def concat(x,y):
  7. nonlocal the_dict
  8. if x and y:
  9. return the_dict[x] + the_dict[y]
  10. elif x:
  11. return the_dict[x]
  12. else:
  13. return the_dict[y]
  14. return reduce(concat,the_dict)
  15.  
  16. d={'a':'fuck ','b':'this ','c':'pluses '}
  17. print('d is\n',d)
  18. print(adder(d))
  19.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/py_compile.py", line 117, in compile
    raise py_exc
py_compile.PyCompileError:   File "prog.py", line 7
    nonlocal the_dict
                    ^
SyntaxError: invalid syntax

stdout
Standard output is empty