Need help multiplying positive numbers in a list by 3, and leaving other numbers unmodified
<p>My goal is to multiply all positive numbers in a list by 3. I think I've almost got the solution but I'm not sure what is causing it not to work. It currently just returns back the original numbers and does not multiply any numbers by 3.</p>

<pre><code>def triple_positives(xs):
    List = []
    product = 3
    for i in range (len(List)):
        if List[i] &gt;= 0:
            product *= i
        List.append(xs[i])
    return xs
</code></pre>

<p>You're iterating over an empty list, and that loop would be trying to access elements that don't exist, change the <code>product</code>, and append unchanged elements from the original list to the new list. And then you return the original, unchanged list anyway. Basically, almost every line in your code is wrong.</p>

<p>You should be looping over the input list and appending multiplied elements to the new list, then return the new list:</p>

<pre><code>def triple_positives(xs):
    List = []
    product = 3
    for i in xs:
        if i &gt; 0:
            List.append(i*product)
    return List
</code></pre>

<p>Also, 0 is not a positive number. Use <code>&gt;</code> instead of <code>&gt;=</code>.</p>

python list numbers multiplying