[Tutor] Is this correct syntax for what I want?
Nathan Pinno
falcon3166 at hotmail.com
Fri Jun 23 22:59:54 CEST 2006
The data is account name and 12.50 (example).
I want to access the data to add and subtract from it.
For example
12.50 - 2.25 = 10.25
10.25 + 4.75 = 15.00
Thanks,
Nathan Pinno
----- Original Message -----
From: "Alan Gauld" <alan.gauld at freenet.co.uk>
To: "Nathan Pinno" <falcon3166 at hotmail.com>; <tutor at python.org>
Sent: Friday, June 23, 2006 2:48 PM
Subject: Re: [Tutor] Is this correct syntax for what I want?
> Nathan,
>
> Can you show us an example of the data?
> And what you want to do to it, ie before and after values.
>
> Its not clear to me whether you want to add the number to the
> number while keeping it in the tuple (Which is impossible
> because tuples are immutable) or whether you simply want
> to access the data to use in an addition/subrtraction storing
> the result elsewhere (which is perfectly possible)
>
> Alan G.
>
> ----- Original Message -----
> From: "Nathan Pinno" <falcon3166 at hotmail.com>
> To: <tutor at python.org>
> Sent: Friday, June 23, 2006 2:20 AM
> Subject: [Tutor] Is this correct syntax for what I want?
>
>
> I want to be able to add and subtract from a number in a tuple in a
> list. Is this the correct syntax?
>
> letterlist[x] = letterlist[x] + amount # for addition
>
> letterlist[x] = letterlist[x] - amount # for subtraction
>
> If this is not correct, what is the correct syntax?
>
> Thanks,
> Nathan Pinno
>
>
>
More information about the Tutor
mailing list