1

I just switched from Python 2 to 3, but this code does not work. What is the problem, please advise.

a = [1, 7, 2, 5, 4, 8]
map(lambda x: x + 2, a)

I expect [3, 9, 4, 7, 6, 10]

rbatt
  • 4,677
  • 4
  • 23
  • 41

1 Answers1

0

Try

a = [1, 7, 2, 5, 4, 8]
list(map(lambda x: x + 2, a))
rbatt
  • 4,677
  • 4
  • 23
  • 41