Try it!


What am I doing wrong?

squares = [x**2 for x in range(1,11)]
filter(lambda x: x >=30 and x <=70, [x**2 for x in range(1,11)])


I did not print the filter!!


The problem is simple, You're not printing the list that o/p-ed by filter function.

You created a list called square using list-comprehension ,then you're not passing it to filter function?
just pass square list that you created at first line as second argument of filter function, You do not have to create a list again.


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