Skip to content

Instantly share code, notes, and snippets.

@ae5259
Created March 16, 2023 14:33
Show Gist options
  • Save ae5259/eee1743f69d4fa53bef5a4f5c3ab44ea to your computer and use it in GitHub Desktop.
Save ae5259/eee1743f69d4fa53bef5a4f5c3ab44ea to your computer and use it in GitHub Desktop.
nums = list(range(20))
evens = [num for num in nums if num%2==0]
odds = [num for num in nums if num%2!=0]
print(evens)
print(odds)
print(sum(evens))
print(sum(odds))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment