Print python module statement as it is above command line

I want to print the module statement as it is above the command line: For example, it should look like this:
12
2% 4

or
thirty%
40%

I use the print statement as follows:

print 'calculations% s %% s'% (num1, pit2)

It throws a default error:

TypeError: not all arguments are converted during string formatting

I am currently using:

print 'compute 1' + '%' + '2'

which prints:

calculation 1% 2

But tell how to do this using the first approach (: print 'computing% s %% s'% (num1, num2))

+4
source share
2 answers

Remove the% sign with a different% sign, for example:

print 'computing %s %% %s' % (num1, num2) 
+8
source
 print 'computing %s %% %s' % (num1, num2) 
+1
source

All Articles