From: Erik M. Bray Date: Sun, 28 Jul 2013 15:38:18 +0000 (-0400) Subject: Demo module for extreme test-driven development, if we get there. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=refs%2Fheads%2Ftest-davis-2013-07-cmu;p=swc-testing-nose.git Demo module for extreme test-driven development, if we get there. --- diff --git a/python/sw_engineering/scan.py b/python/sw_engineering/scan.py new file mode 100644 index 0000000..99cb96f --- /dev/null +++ b/python/sw_engineering/scan.py @@ -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