about summary refs log tree commit diff
path: root/daily/285easy/2dec.py
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2016-10-10 22:03:50 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2016-10-11 09:16:52 +0700
commitc1628d6538d846f26d6dfd88e495205235c31110 (patch)
tree3fcc67809b8c8fe15ff5c7240f90bda8db6ef385 /daily/285easy/2dec.py
parent73b09b6b69abce68a06815e7cd789ff0ae70e2b2 (diff)
downloadcp-c1628d6538d846f26d6dfd88e495205235c31110.tar.gz
/r/dailyprogrammer Challenge #285: Add Python 3 solutions
Diffstat (limited to 'daily/285easy/2dec.py')
-rwxr-xr-xdaily/285easy/2dec.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/daily/285easy/2dec.py b/daily/285easy/2dec.py
new file mode 100755
index 0000000..a0b6bb2
--- /dev/null
+++ b/daily/285easy/2dec.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python3
+
+tmp = 0
+
+with open('2dec.inp') as fi, open('2dec.out', 'w') as fo:
+    for line in fi:
+        l = []
+        for n in line.split():
+            tmp += int(n)
+            if n != '255':
+                l.append(str(tmp))
+                tmp = 0
+        fo.write(' '.join(l) + '\n')