I encountered this in a function of a program and I don't understand how the %d can work inside a closed quote print statement.
print "%d squared is %d." % (n, squared)
The output when the argument of 10 (which is n) is passed is:
10 squared is 100
nandsquaredare both number variables, which replace the%din the string passed to print. (That's what the%in... d." % (n, ...is used for).%operator is string formating - it has nothing to do with theprintstatement.