diff options
| author | Simon Green <mail@simon.green> | 2021-11-20 17:18:51 +1100 |
|---|---|---|
| committer | Simon Green <mail@simon.green> | 2021-11-20 17:18:51 +1100 |
| commit | caba8c35b04f4f90f507b9ae100b8e1aadd4b1dd (patch) | |
| tree | 6dc9db611124f0d566a5420ccd4132aa288d5367 /challenge-139/sgreen/python/ch-1.py | |
| parent | 25353cecdeecc24086f4e4b0c4b715166ead4db8 (diff) | |
| download | perlweeklychallenge-club-caba8c35b04f4f90f507b9ae100b8e1aadd4b1dd.tar.gz perlweeklychallenge-club-caba8c35b04f4f90f507b9ae100b8e1aadd4b1dd.tar.bz2 perlweeklychallenge-club-caba8c35b04f4f90f507b9ae100b8e1aadd4b1dd.zip | |
sgreen solutions to challenge 139
Diffstat (limited to 'challenge-139/sgreen/python/ch-1.py')
| -rwxr-xr-x | challenge-139/sgreen/python/ch-1.py | 21 |
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:]) |
