Skip to content

Instantly share code, notes, and snippets.

@johnptmcdonald
Last active December 26, 2020 19:21
Show Gist options
  • Save johnptmcdonald/e790523c14fc5f50971a0c1fb9b5a896 to your computer and use it in GitHub Desktop.
Save johnptmcdonald/e790523c14fc5f50971a0c1fb9b5a896 to your computer and use it in GitHub Desktop.
arr = [1, 2, 3, 4, 5, 6]
evens = [num for num in arr if num % 2 == 0]
print(evens)
# [2, 4, 6]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment