Learn

All right! Time to test out filter() and lambda expressions.

cubes = [x ** 3 for x in range(1, 11)] filter(lambda x: x % 3 == 0, cubes)

The example above is just a reminder of the syntax.

Instructions

1.

Create a list, squares, that consists of the squares of the numbers 1 to 10. A list comprehension could be useful here!

Use filter() and a lambda expression to print out only the squares that are between 30 and 70 (inclusive).

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?