aboutsummaryrefslogtreecommitdiff
path: root/challenge-192/sgreen/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-192/sgreen/python/ch-1.py')
-rwxr-xr-xchallenge-192/sgreen/python/ch-1.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-192/sgreen/python/ch-1.py b/challenge-192/sgreen/python/ch-1.py
new file mode 100755
index 0000000000..dc43fc664c
--- /dev/null
+++ b/challenge-192/sgreen/python/ch-1.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import sys
+
+
+def main(n):
+ '''Main function'''
+
+ # Find the first power of two greater than n
+ p = 1
+ while p <= n:
+ p *= 2
+
+ # Print the inverse of n
+ print(p-n-1)
+
+
+if __name__ == '__main__':
+ main(int(sys.argv[1]))