2.1.1.17 Your very first program

The print() function - the keyword arguments

We've said previously that the print() function separates its outputted arguments with spaces. This behavior can be changed, too.
The keyword argument that can do this is named sep (like separator).
Look at the code in the editor, and run it.
The sep argument delivers the following results:
My-name-is-Monty-Python.
output
The print() function now uses a dash, instead of a space, to separate the outputted arguments.
Note: the sep argument's value may be an empty string, too. Try it for yourself.


print("My", "name", "is", "Monty", "Python.", sep="-")
  • Console 

Comments

Popular Posts