python2:
print "hello",
print "there"
note the trailing comma. A trailing comma after a print statement suppresses the newline character. Note also that we do not put a space on the end of hello -- a trailing comma for print also puts a space after the string.
It works even in the compound statement with multiple strings:
python2:
print "hello", "there", "henry",
print "!"
prints:
hello there henry !
In python3:
print("hello ", end=' ')
print("there", end='')
the default value of the end parameter for the print function is '\n', which is the newline character. So in python3 you suppress the newline character yourself by specifying the end character to be an empty string.
Note: You can use any string as the end symbol:
print("hello", end='LOL')
print("there", end='')
prints:
helloLOLthere
You could, for instance, make end=' ' to avoid adding spaces to the end of your printed string. That's very useful :)
print("hello", end=' ')
print("there", end='')