Python: Lambda and List Comprehensions

From MyWiki
Revision as of 11:18, 28 July 2019 by George2 (Talk | contribs)

Jump to: navigation, search
my_function = lambda a, b, c : a + b
my_function(1, 2, 3)
 
# We will replace the following with a List Comprehension
my_list = []
for number in range(1,1000):
    if number %2 == 0:
         my_list.append(number)
 
my_list