aboutsummaryrefslogtreecommitdiff
path: root/challenge-279/zapwai/python/ch-1.py
blob: 7490c50a5fe43fb55ceb3c14ff16135e409a8eb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)