String splitting within a list
<p>I'm supposed to create a function called <code>lastfirst()</code> that takes this input:
<code>['Gerber, Len', 'Fox, Kate', 'Dunn, Bob']</code></p>

<p>Then the function should return a list containing two lists of first names and last names, like this:
<code>[['Len', 'Kate', 'Bob'],['Gerber', 'Fox', 'Dunn']]</code></p>

<p>I'm not sure why this is causing me so many problems and I've tried so many different ways of figuring it out, but I just can't get it. Any help is appreciated. :)</p>

<p>In Repl</p>

<pre><code>&gt;&gt;&gt; l = ['Gerber, Len', 'Fox, Kate', 'Dunn, Bob']
&gt;&gt;&gt; print [[x.split(',')[1].strip() for x in l],  [x.split(',')[0].strip() for x in l]]
[['Len', 'Kate', 'Bob'], ['Gerber', 'Fox', 'Dunn']]
</code></pre>

python