Skip to content

Instantly share code, notes, and snippets.

@Rachitlohani
Created January 21, 2015 03:57
Show Gist options
  • Save Rachitlohani/3ec346aa4dca0975aa1f to your computer and use it in GitHub Desktop.
Save Rachitlohani/3ec346aa4dca0975aa1f to your computer and use it in GitHub Desktop.
python
print("Total score for %s is %s " % (name, score))
Or use the new-style string formatting:
print("Total score for {} is {}".format(name, score))
Or pass the values as parameters and print will do it:
print("Total score for", name, "is", score)
If you don't want spaces to be inserted automatically by print, change the sep parameter:
print("Total score for ", name, " is ", score, sep='')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment