Skip to content

Instantly share code, notes, and snippets.

@se7enack
Last active February 17, 2024 18:14
Show Gist options
  • Select an option

  • Save se7enack/0dc4f9f2880f5f3c85f4159aeaa80e20 to your computer and use it in GitHub Desktop.

Select an option

Save se7enack/0dc4f9f2880f5f3c85f4159aeaa80e20 to your computer and use it in GitHub Desktop.
#!/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