python 3:
print('Python', 3, 'Rocks')
>>> Python 3 Rocks
with sep:
print('Python', 3, 'Rocks', sep='|')
>>> Python|3|Rocks
(sep=' ' is added by default, so to print space between values,
sep is not necessary)
with end:
by default, end="
" is appended, so to print a new line after, end is not
necessary. However you can replace
with something else.
print('Python', 3, 'Rocks', end='*')
print('I love Python')
>>> Python 3 Rocks*I love Python
python 2:
print 'Python', 2, 'Rocks'
>>> Python 2 Rocks
with sep:
from __future__ import print_function
print("Python","Rocks", sep="|")
>>> Python|3|Rocks
similar to end:
just add a comma after the first print statement
print 'Python', 2, 'Rocks', '*',
print 'I love Python'
>>> Python 3 Rocks*I love Python