Lambda function Python3 no change in output
<pre><code>def salary_sort(thing):
    def importantparts(thing):
        for i in range(1, len(thing)):
            a=thing[i].split(':')
            output = (a[1],a[0],a[8])
            sortedlist = sorted(output, key = lambda item: item[2], reverse=True)
            print(sortedlist)
    return importantparts(thing)

salary_sort(employee_data)
</code></pre>

<p>This function is supposed to sort out a list of names by their salary. 
I managed to isolate the first last names and salaries but I can't seem to get it to sort by their salaries </p>

<p>'Thing' aka employee_data</p>

<pre><code>employee_data = ["FName  LName   Tel      Address  City   State  Zip   Birthdate   Salary",
"Arthur:Putie:923-835-8745:23 Wimp Lane:Kensington:DL:38758:8/31/1969:126000",
"Barbara:Kertz:385-573-8326:832 Ponce  Drive:Gary:IN:83756:12/1/1946:268500",
"Betty:Boop:245-836-8357:635 Cutesy Lane:Hollywood:CA:91464:6/23/1923:14500",.... etc.]
</code></pre>

<p>Output</p>

<pre><code>['Putie', 'Arthur', '126000']
['Kertz', 'Barbara', '268500']
['Betty', 'Boop', '14500']
['Hardy', 'Ephram', '56700']
['Fardbarkle', 'Fred', '780900']
['Igor', 'Chevsky', '23400']
['James', 'Ikeda', '45000']
['Cowan', 'Jennifer', '58900']
['Jesse', 'Neal', '500']
['Jon', 'DeLoach', '85100']
['Jose', 'Santiago', '95600']
['Karen', 'Evich', '58200']
['Lesley', 'Kirstin', '52600']
['Gortz', 'Lori', '35200']
['Corder', 'Norma', '245700']
</code></pre>

<p>You main problem is that you reset the <code>output</code> sequence with each new <em>line</em> instead of first accumulating the data and then sorting. Another problem is that your external function declared an inner one and called it, but the inner one did not return anything. Finally, if you sort strings without converting them to integers, you will get an alphanumeric sort: ('9', '81', '711', '6') which is probably not what you expect.</p>

<p>By the way, the outer-inner functions pattern is of no use here, and you can use a simple direct function.</p>

<pre><code>def salary_sort(thing):
    output = []
    for i in range(1, len(thing)):
        a=thing[i].split(':')
        output.append([a[1],a[0],a[8]])
    sortedlist = sorted(output, key = lambda item: int(item[2]), reverse=True)
    return sortedlist
</code></pre>

<p>the result is as expected:</p>

<pre><code>[['Kertz', 'Barbara', '268500'], ['Putie', 'Arthur', '126000'], ['Boop', 'Betty', '14500']]
</code></pre>

<hr>

<p>If you prefer numbers for the salaries, you do the conversion one step higher:</p>

<pre><code>def salary_sort(thing):
    output = []
    for i in range(1, len(thing)):
        a=thing[i].split(':')
        output.append([a[1],a[0],int(a[8])])
    sortedlist = sorted(output, key = lambda item: item[2], reverse=True)
    return sortedlist
</code></pre>

<p>and the result is again correct:</p>

<pre><code>[['Kertz', 'Barbara', 268500], ['Putie', 'Arthur', 126000], ['Boop', 'Betty', 14500]]
</code></pre>

python sorting lambda