diff options
| author | chirvasitua <stuart-little@users.noreply.github.com> | 2021-04-11 10:32:19 -0400 |
|---|---|---|
| committer | chirvasitua <stuart-little@users.noreply.github.com> | 2021-04-11 10:32:19 -0400 |
| commit | 0032d0899cc76d79ed7c88cd17b05a23f2eb386b (patch) | |
| tree | 470d399e1e43067386d40c731d681cf13b227fd9 /challenge-107 | |
| parent | f229dc0bbcf4d4f9f65580150c95be2416398a30 (diff) | |
| download | perlweeklychallenge-club-0032d0899cc76d79ed7c88cd17b05a23f2eb386b.tar.gz perlweeklychallenge-club-0032d0899cc76d79ed7c88cd17b05a23f2eb386b.tar.bz2 perlweeklychallenge-club-0032d0899cc76d79ed7c88cd17b05a23f2eb386b.zip | |
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)))) |
