Last active
February 17, 2024 18:14
-
-
Save se7enack/0dc4f9f2880f5f3c85f4159aeaa80e20 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| nums = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] | |
| # filter for prime numbers | |
| prime = list(filter(lambda number: all(number % i != 0 for i in range(2, int(number**0.5) + 1)), nums)) | |
| print(prime) | |
| # cube them | |
| cubed = list(map(lambda x: x**3, prime)) | |
| print(cubed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment