diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-04-11 16:59:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-11 16:59:12 +0100 |
| commit | f4977d3e7f7ae3bda66fbc2645f39745ad1cd1e5 (patch) | |
| tree | e4dd55fbc8b7b40b41c28ebfd217da4ceecd5224 /challenge-107 | |
| parent | 00542395cd82a39718b5c944a441ddb2c42e95f2 (diff) | |
| parent | 0032d0899cc76d79ed7c88cd17b05a23f2eb386b (diff) | |
| download | perlweeklychallenge-club-f4977d3e7f7ae3bda66fbc2645f39745ad1cd1e5.tar.gz perlweeklychallenge-club-f4977d3e7f7ae3bda66fbc2645f39745ad1cd1e5.tar.bz2 perlweeklychallenge-club-f4977d3e7f7ae3bda66fbc2645f39745ad1cd1e5.zip | |
Merge pull request #3863 from stuart-little/stuart-little_107_python
1st commit on 107_python
Diffstat (limited to 'challenge-107')
| -rwxr-xr-x | challenge-107/stuart-little/python/ch-1.py | 13 | ||||
| -rwxr-xr-x | challenge-107/stuart-little/python/ch-2.py | 15 |
2 files changed, 28 insertions, 0 deletions
diff --git a/challenge-107/stuart-little/python/ch-1.py b/challenge-107/stuart-little/python/ch-1.py new file mode 100755 index 0000000000..fee687d3fc --- /dev/null +++ b/challenge-107/stuart-little/python/ch-1.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +# run <script> + +dct = { + 100: (4,1210), + 136: (4,2020), + 1425: (5,21200), +} + +for k in dct.keys(): + print(f"Base 10: {k}") + print(f"Base {dct[k][0]}: {dct[k][1]}\n") diff --git a/challenge-107/stuart-little/python/ch-2.py b/challenge-107/stuart-little/python/ch-2.py new file mode 100755 index 0000000000..95084eaace --- /dev/null +++ b/challenge-107/stuart-little/python/ch-2.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +# run <script> <path-to-module> +# defaults to the os module + +import importlib.machinery +import os +import sys + +pth = os.__file__ if (len(sys.argv) < 2) else sys.argv[1] + +module_name="" +file_loader = importlib.machinery.SourceFileLoader(module_name, pth) +mod = file_loader.load_module() +print(list(filter(lambda x: eval(f"callable(mod.{x})"), dir(mod)))) |
