aboutsummaryrefslogtreecommitdiff
path: root/challenge-180/sgreen/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-180/sgreen/python/ch-1.py')
-rwxr-xr-xchallenge-180/sgreen/python/ch-1.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/challenge-180/sgreen/python/ch-1.py b/challenge-180/sgreen/python/ch-1.py
new file mode 100755
index 0000000000..5364bf6aff
--- /dev/null
+++ b/challenge-180/sgreen/python/ch-1.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+import sys
+
+
+def main(phrase):
+ # Go through each character
+ for i in range(len(phrase)-1):
+
+ # If the letter in that position does not occur later, print the index
+ if phrase[i] not in phrase[i+1:]:
+ print(i)
+ return
+
+ # Oh dear. Nothing unique!
+ print('No unique characters!')
+
+
+if __name__ == '__main__':
+ main(sys.argv[1])