Created
April 25, 2017 13:11
-
-
Save pmutua/0aa9e3dc327114c41a279dda884f4837 to your computer and use it in GitHub Desktop.
Data Structures Lab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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