From ab1c6b9c947b8a59687b55d25100a3d1cca9fe68 Mon Sep 17 00:00:00 2001 From: "Erik M. Bray" Date: Sun, 28 Jul 2013 11:38:18 -0400 Subject: [PATCH] Demo module for extreme test-driven development, if we get there. --- python/sw_engineering/scan.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 python/sw_engineering/scan.py 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 -- 2.26.2