Iterate and assign value - Python - Numpy
<p>IÂ´m a newbie in Python.</p>

<p>IÂ´m trying to do something like this. Iterate an array, compare the value with a constant and assign values to another array.</p>

<p><img src="http://i.stack.imgur.com/r0Sqk.jpg" alt="What IÂ´m trying to do"></p>

<p>Thanks in advance!</p>

<p>Regards</p>

<p>Eduardo</p>

<pre><code>// A is the original list
// constant - f(y)

newList = list()
for i in A:
    if i &lt; constant: newList.append(i)
    else: newList.append(constant)
</code></pre>

python arrays loops numpy