import sys import threading from time import sleep def arg_to_list(string): return [int(x.strip(" "), 10) for x in string.split(',')] def sleep_sort(i, output): sleep(i) output.append(i) def error_and_exit(): print('Usage: please provide a list of at least two integers to sort in the format "1, 2, 3, 4, 5"') sys.exit() def main(): if len(sys.argv) == 1 or not sys.argv or len(sys.argv.split(",")) == 1: error_and_exit() array = arg_to_list(sys.argv) threads =  output =  for i in array: arg_tuple = (i, output) thread = threading.Thread(target=sleep_sort, args=arg_tuple) thread.start() threads.append(thread) for thread in threads: thread.join() print(output) main()
Sleep Sort in Python was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.