With the %
operator:
print '%+d' % score
With str.format
:
print '{0:+d}'.format(score)
You can see the documentation for the formatting mini-language here.
With the %
operator:
print '%+d' % score
With str.format
:
print '{0:+d}'.format(score)
You can see the documentation for the formatting mini-language here.