$ curl cheat.sh/
#  In Python2, `print` was a keyword which introduced a statement:

 print "Hi"

#  In Python3, `print` is a function which may be invoked:

 print ("Hi")

#  In both versions, `%` is an operator which requires a string on the
#  left-hand side and a value or a tuple of values or a mapping object
#  (like `dict`) on the right-hand side.
#  
#  So, your line ought to look like this:

 print("a=%d,b=%d" % (f(x,n),g(x,n)))

#  Also, the recommendation for Python3 and newer is to use `{}`-style
#  formatting instead of `%`-style formatting:

 print('a={:d}, b={:d}'.format(f(x,n),g(x,n)))

#  Python 3.6 introduces yet another string-formatting paradigm: [f-strin
#  gs](https://docs.python.org/3/reference/lexical_analysis.htmlf-string
#  s).

 print(f'a={f(x,n):d}, b={g(x,n):d}')

#  [Robᵩ] [so/q/19457227] [cc by-sa 3.0]

$
Follow @igor_chubin cheat.sh