Printing python modulus operator as it is over command line

modulo, operators, python

Solution

Escape the % sign with another % sign, like this:

print 'computing %s %% %s' % (num1, num2)

Problem

I want to print modulus operator as it is over the command line: E.g this is how the output should look like: 1%2 2%4 or 30% 40% I am using the print statement like this: print 'computing %s % %s' % (num1, num2) Its throwing the default error: TypeError: not all arguments converted during string formatting For now I am using: print 'computing 1'+'%'+'2' which prints: computing 1%2 But tell me how to get this done using the first approach(:print 'computing %s % %s' % (num1,num2))

Original source