Log in from a computer to take this course

You'll need to log in from a computer to start Learn Python 2. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store

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.



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?