diff options
Diffstat (limited to 'challenge-235/sgreen/python/ch-1.py')
| -rwxr-xr-x | challenge-235/sgreen/python/ch-1.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/challenge-235/sgreen/python/ch-1.py b/challenge-235/sgreen/python/ch-1.py new file mode 100755 index 0000000000..59c3e710c9 --- /dev/null +++ b/challenge-235/sgreen/python/ch-1.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +import sys + + +def main(ints): + # Loop through each position of the list + for i in range(len(ints)): + # Make a new list with the integer at that position remove + new_list = ints.copy() + del new_list[i] + + # Check if the list is incremental + if all(new_list[j-1] <= new_list[j] for j in range(1, len(new_list))): + # It is, tell the user about it + print('true') + return + + # Oh dear. No solution is possible + print('false') + + +if __name__ == '__main__': + # Convert input into integers + array = [int(n) for n in sys.argv[1:]] + main(array) |
