Alberto Vieira Ferreira Monteiro <[EMAIL PROTECTED]> writes:
> Hi, I am new to Python, how stupid can be the questions I ask?

Well, it's a matter of how you ask them, but anyway newcomers
are welcome here.

> For example, how can I add (mathematically) two tuples?
> x = (1,2)
> y = (3,4)
> How can I get z = (1 + 3, 2 + 4) ?

The simplest way is explicitly:

    z = (x[0]+y[0], x[1]+y[1])

There's not a really direct way to do it.  Tuples aren't vectors.

Python does support complex numbers if that's what you want:
   
   x = 1+2j   # Python uses "j" for sqrt(-1)
   y = 3+4j
   z = x + y
   print z
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to