diff options
author | Jan Huwald <jh@sotun.de> | 2013-01-31 11:05:32 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2013-01-31 11:05:32 (GMT) |
commit | 3ce4b80aca1dd238f00cbedfd7ef015842f6ca9f (patch) | |
tree | 08dbb6a127621556ba354ea40f70a81ed57990bb | |
parent | 32609a3cf6b4f7f62d0f0c3bddc719ad66ad364f (diff) |
add cumulate
-rwxr-xr-x | cumulate | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cumulate b/cumulate new file mode 100755 index 0000000..1ec3b4d --- /dev/null +++ b/cumulate @@ -0,0 +1,15 @@ +#!/usr/bin/python + +import sys + +total=0 +while 1: + try: + line = sys.stdin.readline() + if not line: + break + total += int(line) + print total + except: + sys.exit(1) + |