Demo module for extreme test-driven development, if we get there. test-davis-2013-07-cmu
authorErik M. Bray <embray@stsci.edu>
Sun, 28 Jul 2013 15:38:18 +0000 (11:38 -0400)
committerW. Trevor King <wking@tremily.us>
Sat, 9 Nov 2013 18:33:56 +0000 (10:33 -0800)
python/sw_engineering/scan.py [new file with mode: 0644]

diff --git a/python/sw_engineering/scan.py b/python/sw_engineering/scan.py
new file mode 100644 (file)
index 0000000..99cb96f
--- /dev/null
@@ -0,0 +1,10 @@
+def scan(lst):
+    total = 0
+    last = None
+    if len(lst) == 0:
+        return total
+    for item in lst:
+        if last is None or item > last:
+            total += item
+            last = item
+    return total