13 Lambda Syntax [solved]


#1

error
File "python", line 2
SyntaxError: lambda cannot contain assignment

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

Instructions
Fill in the first part of the filter function with a lambda. The lambda should ensure that only "Python" is returned by the filter.
Fill in the second part of the filter function with languages, the list to filter.


#2

MY bad, silly error :stuck_out_tongue

print filter(lambda x: x == "Python", languages)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.