I tried this code from this question - Python insertion sort. I modified the code a bit, got rid of the eval(). 
def sort_numbers(s):
    for i in range(1, len(s)):
        val = s[i]
        j = i - 1
        while (j >= 0) and (s[j] > val):
            s[j+1] = s[j]
            j = j - 1
        s[j+1] = val
    print s
x = raw_input("Enter numbers to be sorted: ").split()
sort_numbers(x)
It doesn't work for a few too many test cases.
In: 1001 101 20 24 2000
Out: 1001 101 20 2000 24
I've also tried with some negative numbers. The code doesn't work. Why is this so?