Post

@PythonPr map() is cleaner than a manual loop.
But list comprehension is even better:
squares = [n**2 for n in List]
One line. No extra function needed.
Readable, fast, and Pythonic.
English

@PythonPr I don't know what map is, looks too complex. The solution is even simpler.
In [1]: list = [1, 2, 3, 4, 5]
In [2]: squares = [x**2 for x in list]
In [3]: print(squares)
[1, 4, 9, 16, 25]
English

@PythonPr i( 1 2 3 4 5 )i .. *i |>| 1 4 9 16 25
duplicating & multiplying /\
i( 1 2 3 4 5 )i 2 _i ^i |>| 1 4 9 16 25
actual squaring /\
FORTH.CoSy simplified & generalized from APL & open vocabulary to the hardware as only possible in FORTH .
English



