From 6a30f27182af9a9ae0ce1a671bc49d2065a8164b Mon Sep 17 00:00:00 2001 From: deadmarshal Date: Sun, 21 Jan 2024 12:30:15 -0500 Subject: TWC252 --- challenge-252/deadmarshal/python/ch1.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 challenge-252/deadmarshal/python/ch1.py (limited to 'challenge-252/deadmarshal/python/ch1.py') diff --git a/challenge-252/deadmarshal/python/ch1.py b/challenge-252/deadmarshal/python/ch1.py new file mode 100644 index 0000000000..803e722eb5 --- /dev/null +++ b/challenge-252/deadmarshal/python/ch1.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +def special_numbers(arr): + ret = [] + for i in range(len(arr)): + if len(arr) % (i+1) == 0: ret.append(arr[i]**2) + return sum(ret) + +print(special_numbers([1,2,3,4])) +print(special_numbers([2,7,1,19,18,3])) -- cgit