Skip to content

Instantly share code, notes, and snippets.

@pmutua
Created April 25, 2017 13:11
Show Gist options
  • Save pmutua/0aa9e3dc327114c41a279dda884f4837 to your computer and use it in GitHub Desktop.
Save pmutua/0aa9e3dc327114c41a279dda884f4837 to your computer and use it in GitHub Desktop.
Data Structures Lab
def manipulate_data(data):
if isinstance(data, list):
return [sum(1 for n in data if isinstance(n, int) and n >= 0),
sum(n for n in data if isinstance(n, int) and n < 0)]
else:
return 'Only lists allowed'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment