diff options
| author | deadmarshal <adeadmarshal@gmail.com> | 2024-07-22 16:32:56 +0330 |
|---|---|---|
| committer | deadmarshal <adeadmarshal@gmail.com> | 2024-07-22 16:32:56 +0330 |
| commit | 91d8796de5dfd9cb380e2d2a642e9c93059fa8ff (patch) | |
| tree | ff68c05918d5a7b25804fb8ae6d3a5fd6cb40ad2 /challenge-279/deadmarshal/python/ch1.py | |
| parent | 7cc71a882e416db99d281ec66b276be1d0acc481 (diff) | |
| download | perlweeklychallenge-club-91d8796de5dfd9cb380e2d2a642e9c93059fa8ff.tar.gz perlweeklychallenge-club-91d8796de5dfd9cb380e2d2a642e9c93059fa8ff.tar.bz2 perlweeklychallenge-club-91d8796de5dfd9cb380e2d2a642e9c93059fa8ff.zip | |
TWC279
Diffstat (limited to 'challenge-279/deadmarshal/python/ch1.py')
| -rw-r--r-- | challenge-279/deadmarshal/python/ch1.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/challenge-279/deadmarshal/python/ch1.py b/challenge-279/deadmarshal/python/ch1.py new file mode 100644 index 0000000000..f1125f2bcb --- /dev/null +++ b/challenge-279/deadmarshal/python/ch1.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +def sort_letters(letters,weights): + d = dict(zip(letters,weights)) + return ''.join(sorted(d.keys(),key=lambda k: d[k])) + +print(sort_letters(['R','E','P','L'],[3,2,1,4])) +print(sort_letters(['A','U','R','K'],[2,4,1,3])) +print(sort_letters(['O','H','Y','N','P','T'],[5,4,2,6,1,3])) + |
