diff options
| -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(':')])) |
