Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.083 X-Spam-Evidence: '*H*': 0.83; '*S*': 0.00; 'thx': 0.09; 'cc:addr :python-list': 0.10; '>>>': 0.18; 'simpler': 0.22; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'probably': 0.29; 'function': 0.30; 'subject:lists': 0.32; 'cases,': 0.33; 'hi,': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'tool': 0.36; 'skip:z 10': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'header:Received:5': 0.40; 'to:charset:iso-8859-1': 0.75; '======': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=w2IvvvZs4hXh8IESdj+9IMZ+eZTKFTsz/WjI5YiPU0Y=; b=wLWXe17R94rOo8U+wvUUWiLcLTyGsshlTJ88pVSaiSmrDVd/WwKWMbJwz+QytCNFU3 fTO43ng2r6h2WOkeWvMq65lalTchz28MIw64yvxQ5d+VMXhAY0wRVefZvzIRruZyGI5V EI2H3Gnst3+tNBI6NRbCciSTTyPRov7dtVrm1L65zKjzHRkh9U0eb7lZRhnEhiaOpHwW QEmc1haOreank61gGqwYNaTnOCk/Qfek95qdQhsmWksSZMSDteg4FQg3QTVlOr0RQ5l6 fVGXH0dpOSvwPIu0wr2e2bawss0FAaXD/Eo4fg//0ZqwTfEsgXHKDGyu49ysrzMuKuPf +p/Q== MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 19 Dec 2012 13:38:28 +0100 Subject: Re: calculation on lists From: Vlastimil Brom To: =?ISO-8859-1?Q?lo=EFc_Laur=E9ote?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355920717 news.xs4all.nl 6897 [2001:888:2000:d::a6]:47246 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35107 2012/12/19 lo=EFc Laur=E9ote : hi, I have a question, is there a tool to calculate on list ? something like : >a=3D [1,1,1,1] >b =3D [5,9,8,4] >c =3D a+b*a >print c >[6,10,9,5] Thx =3D=3D=3D=3D=3D=3D Hi, for such simpler cases, you may try list comprehensions and probably the zip(...) function >>> [a+b*a for a,b in zip([1,1,1,1], [5,9,8,4])] [6, 10, 9, 5] >>> hth, vbr