aboutsummaryrefslogtreecommitdiff
path: root/challenge-262/zapwai/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-262/zapwai/python/ch-2.py')
-rw-r--r--challenge-262/zapwai/python/ch-2.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/challenge-262/zapwai/python/ch-2.py b/challenge-262/zapwai/python/ch-2.py
new file mode 100644
index 0000000000..a78b532467
--- /dev/null
+++ b/challenge-262/zapwai/python/ch-2.py
@@ -0,0 +1,11 @@
+ints = [3, 1, 2, 2, 2, 1, 3]
+k = 2
+print("Input: ints:", ints, "k:", k)
+cnt = 0
+for i in range(len(ints) - 1):
+ for j in range(i + 1, len(ints)):
+ if ints[i] != ints[j]:
+ continue
+ if i * j % k == 0:
+ cnt += 1
+print("Output:", cnt)