Skip to content

Instantly share code, notes, and snippets.

@raihanba13
Created January 7, 2020 16:40
Show Gist options
  • Save raihanba13/f9abfc3dc268e6fdc444828d06df6957 to your computer and use it in GitHub Desktop.
Save raihanba13/f9abfc3dc268e6fdc444828d06df6957 to your computer and use it in GitHub Desktop.
odd = lambda x : bool(x % 2)
numbers = [n for n in range(10)]
numbers[:] = [n for n in numbers if not odd(n)] # ahh, the beauty of it all
numbers
# output [0, 2, 4, 6, 8]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment