Lambda Syntax


#1



https://www.codecademy.com/en/courses/python-beginner-en-KAgt5/3/2?curriculum_id=4f89dab3d788890003000096#


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)


#2

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


#3

Thanks a lot. The code works now.


#4