May-22-2018, 03:27 PM
Hi,
I am trying to wrap my head around lambda but I am running into issues.
The homework question is: Write a lambda function that takes a list my_list and returns a list which includes only even numbers
I am trying to wrap my head around lambda but I am running into issues.
The homework question is: Write a lambda function that takes a list my_list and returns a list which includes only even numbers
my_list = [1, 5, 4, 6, 8, 11, 3, 12] test = lambda my_list: my_list % 2 == 0 print test(my_list)I feel like that should do it but I get an error when I try to run it. Not sure what is wrong with my logic.