I\'m writing a function that takes a list L as a parameter and returns a list consisting of all the elements in L that are perfect squares.
def isPerfectSquare(
This is a good place to use lambda. Also, no need to use list() if Python 2.x or the extra parens.
lambda
list()
import math def perfectSquares2(L): return filter(lambda n: n==int(math.sqrt(n))**2, L)