aboutsummaryrefslogtreecommitdiff
path: root/challenge-139/sgreen/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-139/sgreen/python/ch-1.py')
-rwxr-xr-xchallenge-139/sgreen/python/ch-1.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/challenge-139/sgreen/python/ch-1.py b/challenge-139/sgreen/python/ch-1.py
new file mode 100755
index 0000000000..6f27eb1b31
--- /dev/null
+++ b/challenge-139/sgreen/python/ch-1.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+import sys
+
+
+def main(strings):
+ # Convert to numbers
+ nums = [float(x) for x in strings]
+ sorted = 1
+
+ for i in range(1, len(nums)):
+ # If the value is less than the previous, the array is not sorted
+ if nums[i] < nums[i - 1]:
+ sorted = 0
+ break
+
+ print(f"{sorted}")
+
+
+if __name__ == '__main__':
+ main(sys.argv[1:])