diff options
Diffstat (limited to 'challenge-252/zapwai/python/ch-1.py')
| -rw-r--r-- | challenge-252/zapwai/python/ch-1.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/challenge-252/zapwai/python/ch-1.py b/challenge-252/zapwai/python/ch-1.py new file mode 100644 index 0000000000..541d927568 --- /dev/null +++ b/challenge-252/zapwai/python/ch-1.py @@ -0,0 +1,14 @@ +def proc(ints): + spec = [] + for i in range(len(ints)): + if len(ints) % (i+1) == 0: + spec.append(ints[i]) + sum = 0 + for v in spec: + sum += v*v + print("Input: ints =", ints) + print(f"Output: {sum}") +ints = [1,2,3,4] +proc(ints) +ints = [2, 7, 1, 19, 18, 3] +proc(ints) |
