def insert_ordered(value, array):
index = <NUM_LIT:0><EOL>for n in range(<NUM_LIT:0>,len(array)):<EOL><INDENT>if value >= array[n]: index = n+<NUM_LIT:1><EOL><DEDENT>array.insert(index, value)<EOL>return index<EOL>
This will insert the value into the array, keeping it sorted, and returning the
index where it was inserted