[Tutor] trying to figure out what this means

Alan Gauld alan.gauld at btinternet.com
Tue May 8 15:43:15 CEST 2007

"Dave C" <wheresdave at gmail.com> wrote

> when you are doing print these two characters keep showing up in 
> this book
> "%s" %
> What do they do?

Its called string formatting.
%s means insert a string(the s) here.
%d means insert a decimal number(the d) here
There are a whole bunch of other codes and you can add extra
fomatting info too(width, justification etc).

This is covered in the Simple Sequences topic of my tutorial.

Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list