Lambda Syntax


Oops, try again. Make sure to pass both arguments to filter()!

how do you make it work according to the syntax example given?

languages = ["HTML", "JavaScript", "Python", "Ruby"]
print filter(lambda:"Python", languages)

How to write the code

look at the example:

my_list = range(16)
filter(lambda x: x % 3 == 0, my_list)

lambda x, x is your function parameter. then x % 3 == 0 is your condition. In your case, the condition should be slightly different


whats the condition in this? .( i thought you call on the index in the list i.e languages[2])


to check if x (or whatever you use for function parameter) equals Python


ThankYou @stetim94 I got it! worked!