[Tutor] RE: I don't understand why it doesn't work :(
David Broadwell
dbroadwell@mindspring.com
Tue Jun 3 13:48:45 2003
> I expected 17 because I thought that
> print int (s) convert my string in an integer
> so that the addition between 3*4 and 5 was possible.
That would be eval(), consider this;
>>> s = "3 * 4"
>>> eval(s)
12
>>> print eval(s) + 5
17
When you assigned s had you used;
>>> s = 3 * 4
Your results would have been what you expected.
What do you get when you int("3 * 4") ?
--
David Broadwell