79674531

Date: 2025-06-21 14:57:38
Score: 1
Natty:
Report link
from operator import itemgetter

l =[{'value': 'apple', 'blah': 2}, 
 {'value': 'banana', 'blah': 3} , 
 {'value': 'cars', 'blah': 4}]

#option 1
new_list_1 = list(map(itemgetter("value")))


#option 2
def get_value(i):
    return i["value"]
new_list_2 = list(map(get_value, l))
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Ntuthuko Hlela