14.try it!


I was able to solve this exercise by using hit as lambda x: x>=30 and x<=70; However, I was wondering if we can use slicing as part of lambda?
I am not sure about my code if slicing is a possible solution.

squares=[i**2 for i in range(1,11)]
print filter(lambda x:x[5:9:] and x<=70,squares )


There's nothing stopping you from slicing in a lambda, although I don't see why you would want to use it there (what would you be slicing, is that really sliceable?)


hmm make sense. gotcha, thanks for clarifying!


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