Lambda Syntax


When I run the code, an empty list is printed and an error message pops up saying
"Oops, try again. It looks like your filter() didn't print ['Python'] to the console."

It ought to print "Python"

Please help with fixing the code.

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


x will be values from the list, not indexes, so you need to check if x equals python, not 2


Thanks a lot. The code works now.