Adding Specific Value to Nested Lists
<p>I'm having a comprehension issue on a specific problem. I have a preexisting nested list, and I want to match and append one value from a different list to the end of each nested list. A quick example of what I've tried, but where I'm stuck: </p>

<pre><code> initial_values = [["First", 1], ["Second", 2], ["Third", 3], ["Fourth", 4]]
other_values = [1,2,3,4]

for sublist in initial_values:
    for i in other_values:
        sublist.append(i)


print initial_values
</code></pre>

<p>This returns <code>[['First', 1, 1, 2, 3, 4], ['Second', 2, 1, 2, 3, 4], ['Third', 3, 1, 2, 3, 4], ['Fourth', 4, 1, 2, 3, 4]]</code></p>

<p>I want it it to ideally return <code>[['First', 1, 1], ['Second', 2, 2], ['Third', 3, 3], ['Fourth', 4, 4]]</code></p>

<p>One of the alternative to achieve it using <a href="https://docs.python.org/2/library/functions.html#map" rel="nofollow"><code>map()</code></a> as:</p>

<pre><code>&gt;&gt;&gt; map(lambda x: x[0] + [x[1]], zip(initial_values, other_values))
[['First', 1, 1], ['Second', 2, 2], ['Third', 3, 3], ['Fourth', 4, 4]]
</code></pre>

python list