diff options
Diffstat (limited to 'challenge-251/zapwai/python/ch-1.py')
| -rw-r--r-- | challenge-251/zapwai/python/ch-1.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-251/zapwai/python/ch-1.py b/challenge-251/zapwai/python/ch-1.py new file mode 100644 index 0000000000..380969324a --- /dev/null +++ b/challenge-251/zapwai/python/ch-1.py @@ -0,0 +1,18 @@ +def proc(ints): + print("Input: ints =", ints) + sum = 0 + while (ints): + a = ints[0] + if len(ints) == 1: + sum += a + break + ints = ints[1:] + b = ints.pop() + sum += int(str(a)+str(b)) + print("Output:", sum) +ints = [6, 12, 25, 1] +proc(ints) +ints = [10, 7, 31, 5, 2, 2] +proc(ints) +ints = [1, 2, 10] +proc(ints) |
