"John" <[EMAIL PROTECTED]> writes: > I have a text file which contains math expression, like this > 134 > +234 > +234
Erm, is this a homework assignment? Basicaly you need to identify all the separate operands and operators and decide what to do with them. I'm guessing you don't have to worry about operator precedence, for example the rule that 2+3*5 is treated as 2+(3*5) because * has precedence over +. Anyway the idea is keep a running total and read through the input lines updating the total for each line. -- http://mail.python.org/mailman/listinfo/python-list