I would like to put the max number(s) to a new array, I\'ve tried every thing that I can think of and none seem to work....(adding to an empty result array, concat, etc)
Working Example in Python 2 — Tested with Python 2.6.9 and 2.7.10
L01 = [[21, 34, 345, 2], [555, 22, 6, 7], [94, 777, 65, 1], [23, 54, 12, 666]]
L02 = map(max, L01)
print(L02)
Output
[345, 555, 777, 666]
Working Example in Python 3 — Tested with Python 3.2.5 and 3.4.3 and 3.5.0
The only difference is that map()
is wrapped by list()
.
L01 = [[21, 34, 345, 2], [555, 22, 6, 7], [94, 777, 65, 1], [23, 54, 12, 666]]
L02 = list(map(max, L01))
print(L02)
Output
[345, 555, 777, 666]