79749773

Date: 2025-08-29 02:39:20
Score: 0.5
Natty:
Report link

Even though list comprehension is the most Pythonic and best way to achieve this, the map() function can also be used:

before = [0, -1, 4, 5, 8]
after = [*map(lambda x: x+2 if x != -1 else x, m_list)] # [2, -1, 6, 7, 10]
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Aadvik