<div dir="ltr">On Wed, Dec 19, 2012 at 4:38 AM, Vlastimil Brom <span dir="ltr"><<a href="mailto:vlastimil.brom@gmail.com" target="_blank">vlastimil.brom@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">2012/12/19 loïc Lauréote <<a href="mailto:laureote-loic@hotmail.fr">laureote-loic@hotmail.fr</a>>:<br>


<div><div class="h5">hi,<br>
I<br>
 have a question,<br>
is there a tool to calculate on list ?<br>
<br>
something like :<br>
<br>
>a= [1,1,1,1]<br>
>b = [5,9,8,4]<br>
>c = a+b*a<br>
>print c<br>
>[6,10,9,5]<br>
<br>
Thx<br>
<br>
</div></div>======<br>
<br>
Hi,<br>
for such simpler cases, you may try list comprehensions and probably<br>
the zip(...) function<br>
<br>
>>> [a+b*a for a,b in zip([1,1,1,1], [5,9,8,4])]<br>
[6, 10, 9, 5]<br>
>>><br></blockquote><div><br></div><div style>You can also use map (Python 2.6):</div><div style>map(lambda a,b: a+b*a, [1,1,1,1], [5,9,8,4])<br></div><div style><br></div><div style>Note that the lambda can be replaced by any callable which takes 2 arguments.</div>

</div></div></div>