fork download
  1. # Swift's closure
  2. # https://d...content-available-to-author-only...e.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html
  3.  
  4.  
  5. digitNames = {
  6. 0: "Zero", 1: "One", 2: "Two", 3: "Three", 4: "Four",
  7. 5: "Five", 6: "Six", 7: "Seven", 8: "Eight", 9: "Nine"
  8. }
  9. numbers = [16, 58, 510]
  10.  
  11.  
  12. strings = map(
  13. lambda number:
  14. output = ''
  15. while number > 0:
  16. output = digitNames[number % 10] + output
  17. number /= 10
  18.  
  19. return output,
  20. numbers
  21. )
  22.  
  23.  
  24. for s in strings:
  25. print(s)
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: SyntaxError: ('invalid syntax', ('prog.py', 15, 13, '        while number > 0:\n'))

stdout
Standard output is empty