Created
March 15, 2014 01:25
-
-
Save elpargo/9560463 to your computer and use it in GitHub Desktop.
A better version of https://www.facebook.com/photo.php?fbid=10153832369885408&set=gm.815617848455062&type=1&theater
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
arr = [1,-1,4,2,1,5,-2] | |
negs = [] | |
for i in arr: | |
if i<0: | |
negs.append(arr.remove(i)) | |
if negs: | |
raise ValueError(negs) | |
else: | |
print sum(arr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment