On Mar 12, 3:02 am, Alberto Vieira Ferreira Monteiro
<[EMAIL PROTECTED]> wrote:
> Hi, I am new to Python, how stupid can be the questions I ask?
>
> For example, how can I add (mathematically) two tuples?
> x = (1,2)
> y = (3,4)
> How can I get z = (1 + 3, 2 + 4) ?
>
> Alberto Monteiro


Alberto -

List comprehesion, no doubt about it:
>>> z = [k+p for k,p in (x, y)]
>>> z
[3, 7]

- Bert

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to