calling to function in function
<p>I need to build 3 funcs.
the 1st is insertion sort, 2nd is generate list of random nums between 0-1 and the 3rd need to create list of randon numbers (using 2nd func.) and sort them (using 1st func.).
I can't change the tests in the end and not the arguments of the funcs.
I have a problem with func 3, it says <code>NameError: global name 'my_list' is not defined</code>.
The other funcs works fine, where am I wrong in the 3rd?
*the 1st func not allowed to return anything.</p>

<p>thanks!</p>

<p>my code:</p>

<pre><code>def insertion_sort(lst):
    for i in range(1,len(lst)):
        current=lst[i]
        j=i-1
        while j&gt;=0:
            if current &lt; lst[j]:
                lst[j+1] = lst[j]
                lst[j] = current
                j-=1
            else:
                break

def random_list(n):
    import random
    my_list=[]
    for i in range(n):
        my_list.append (random.random ())
    return my_list

def sorted_random_list(n):
    random_list(n)
    insertion_sort(my_list)

### TEST FUNCTION - DON'T CHANGE THIS ####
def test_sorted(lst):
    print lst == sorted(lst) and len(lst) &gt; 0

def test_len(lst, length):
    print len(lst)==length

def sort_and_test(lst):
    lst = lst[:]
    insertion_sort(lst)
    test_sorted(lst)

sort_and_test([13,54,3434,88,334,6,8,84,57,4,2,4,6,6])
sort_and_test(["dog","cat","cow","zebra","frog","bat","spider","monkey"])
sort_and_test(["hi","hello","how are you","what your doing"])

test_len(random_list(10), 10)
lst = sorted_random_list(10)
test_len(lst, 10)
test_sorted(lst)
</code></pre>
