diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2020-07-04 20:14:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-04 20:14:50 +0100 |
| commit | 2e0dfd778554a0f10789c8d029a13fceb97b2ce9 (patch) | |
| tree | 71ea409bc6dd0575e279e20f87159c5cd1db1d1e /challenge-067 | |
| parent | afcb7ec3634dc49dffd5c7eb8c8d799aee6e1a6b (diff) | |
| parent | 17a6e55dcdbcec70b03018b3b50319777149525f (diff) | |
| download | perlweeklychallenge-club-2e0dfd778554a0f10789c8d029a13fceb97b2ce9.tar.gz perlweeklychallenge-club-2e0dfd778554a0f10789c8d029a13fceb97b2ce9.tar.bz2 perlweeklychallenge-club-2e0dfd778554a0f10789c8d029a13fceb97b2ce9.zip | |
Merge pull request #1903 from waltman/branch-for-challenge-067
python 3 code for challenge 67
Diffstat (limited to 'challenge-067')
| -rw-r--r-- | challenge-067/walt-mankowski/python/ch-1.py | 7 | ||||
| -rw-r--r-- | challenge-067/walt-mankowski/python/ch-2.py | 17 |
2 files changed, 24 insertions, 0 deletions
diff --git a/challenge-067/walt-mankowski/python/ch-1.py b/challenge-067/walt-mankowski/python/ch-1.py new file mode 100644 index 0000000000..83b9cd47dd --- /dev/null +++ b/challenge-067/walt-mankowski/python/ch-1.py @@ -0,0 +1,7 @@ +from sys import argv +from itertools import combinations + +m, n = [int(x) for x in argv[1:]] +it = combinations(range(1,m+1), n) +combs = [comb for comb in it] +print(combs) diff --git a/challenge-067/walt-mankowski/python/ch-2.py b/challenge-067/walt-mankowski/python/ch-2.py new file mode 100644 index 0000000000..5cb94cfa10 --- /dev/null +++ b/challenge-067/walt-mankowski/python/ch-2.py @@ -0,0 +1,17 @@ +from sys import argv +from itertools import product + +key = {'1': '_@', + '2': 'ABC', + '3': 'DEF', + '4': 'GHI', + '5': 'JKL', + '6': 'MNO', + '7': 'PQRS', + '8': 'TUV', + '9': 'WXYZ', + '0': ' ', + } + +s = argv[1] +print([''.join(p) for p in product(*[key[c] for c in s])]) |
