Lambda Syntax


#1


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
#2

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


#3

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


#4

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


#5

ThankYou @stetim94 I got it! worked!


#6