Re: [Tutor] calculation in string operations

2011-08-03 Thread Sander Sweers
On 4 August 2011 01:16, David wrote: > I got an error message that surprises me. I know how to solve the > problem (couple of parentheses will do), but I would expect Python to > run as the code is presented below. > After all, my_weight is a number that can be multiplied by a float. > I would exp

Re: [Tutor] calculation in string operations

2011-08-03 Thread Alan Gauld
On 04/08/11 00:16, David wrote: After all, my_weight is a number that can be multiplied by a float. I would expect Python to evaluate the expression after the (final) operator and then having it inserted into the string. But it doesn't because the % format operator has a higher precedence. So