[Tutor] Python and Tuples

Karim karim.liateni at free.fr
Sun Jan 30 10:50:31 CET 2011


Hello,

for x, y in t:
    print x*y

Regards
Karim

On 01/30/2011 10:29 AM, Becky Mcquilling wrote:
> I'm fairly new to python and I am trying to do some math with tuples.
>
> If I have a tuple:
>
> t =( (1000, 2000), (2, 4), (25, 2))
> I want to loop through and print out the results of the multiplying 
> the two numbers like so:
>
> 1000 x 2000
> 2 x 4
>
> etc.
>
> I'm not sure of the syntax for that.  Any ideas?
>
> Becky
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110130/3802bef1/attachment-0001.html>


More information about the Tutor mailing list