[Tutor] What does "TypeError: 'int' object is not iterable"mean?
alan.gauld at btinternet.com
Fri Oct 22 20:27:57 CEST 2010
"Richard D. Moores" <rdmoores at gmail.com> wrote
> return ("%%.%sf" % n) % floatt
> which works fine, but a question remains: n is an integer. Why the
> in '%sf'?
Its arbitrary. You could use %d just as easily.
%s will put the numner into the string, so will %d.
%d is probably a bit more picky about what it inserts - so might
actually be a better choice in this case since
Doesn't work as you might hope... but changing it to use %d might -
on your definition of better! And what you might hope! :-)
OTOH %s handles this better:
Author of the Learn to Program web site
More information about the Tutor