diff options
Diffstat (limited to 'challenge-279/zapwai/python/ch-1.py')
| -rw-r--r-- | challenge-279/zapwai/python/ch-1.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-279/zapwai/python/ch-1.py b/challenge-279/zapwai/python/ch-1.py new file mode 100644 index 0000000000..7490c50a5f --- /dev/null +++ b/challenge-279/zapwai/python/ch-1.py @@ -0,0 +1,18 @@ +def proc(l, w): + print("Input: letters =", l, "weights =", w) + ans = [] + for i in range(len(l)): + ans.append("") + for i in range(len(l)): + ans[w[i] - 1] = l[i] + print("Output: ", ans) + +letters = ['R', 'E', 'P', 'L'] +weights = [3, 2, 1, 4] +proc(letters, weights) +letters = ['A', 'U', 'R', 'K'] +weights = [2, 4, 1, 3] +proc(letters, weights) +letters = ['O', 'H', 'Y', 'N', 'P', 'T'] +weights = [5, 4, 2, 6, 1, 3] +proc(letters, weights) |
