diff options
| author | chirvasitua <stuart-little@users.noreply.github.com> | 2021-07-05 08:59:20 -0400 |
|---|---|---|
| committer | chirvasitua <stuart-little@users.noreply.github.com> | 2021-07-05 08:59:20 -0400 |
| commit | 2e5c054ef2fca0281037f04247461b2576e081a5 (patch) | |
| tree | 5b43d4b6a7770b722e2ceb7c39fb5f155ac82832 | |
| parent | d5f2a0c9f3ee311ab8e8d14f6cb67efbc01250ec (diff) | |
| download | perlweeklychallenge-club-2e5c054ef2fca0281037f04247461b2576e081a5.tar.gz perlweeklychallenge-club-2e5c054ef2fca0281037f04247461b2576e081a5.tar.bz2 perlweeklychallenge-club-2e5c054ef2fca0281037f04247461b2576e081a5.zip | |
1st commit on 120_python
| -rwxr-xr-x | challenge-120/stuart-little/python/ch-1.py | 7 | ||||
| -rwxr-xr-x | challenge-120/stuart-little/python/ch-2.py | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/challenge-120/stuart-little/python/ch-1.py b/challenge-120/stuart-little/python/ch-1.py new file mode 100755 index 0000000000..ac482acf9d --- /dev/null +++ b/challenge-120/stuart-little/python/ch-1.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python + +# run <script> <number> + +import sys + +print(int("".join([f"{(int(sys.argv[1]) & 255):08b}"[2*x:2*x+2][::-1] for x in range(4)]) , base=2)) diff --git a/challenge-120/stuart-little/python/ch-2.py b/challenge-120/stuart-little/python/ch-2.py new file mode 100755 index 0000000000..54fa2c90db --- /dev/null +++ b/challenge-120/stuart-little/python/ch-2.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# run <script> <time> + +import sys + +def angl(h,m): + rawDiff = abs((h % 12)*30 + m/2 - m * 6) + return min(rawDiff, 360-rawDiff) + +print(angl(*[int(x) for x in sys.argv[1].split(':')])) |
