I need help with print()

I am fairly new to python and I don’t know how to make this work
example:
print(‘Hello’)
print(‘World’)

As you see, the output is:
Hello
World

But do anyone know how I can make the output go like
Hello World

While still having two prints on 2 lines
(so not like this: print(‘Hello World’))

print('Hello', end=' ')
print('World')
2 Likes

By default, the print() function adds a newline: \n, but you can override that, as Steven has demonstrated.

To add: the build-in ‘help’ is a useful tool:

help(print)
Help on built-in function print in module builtins:

print(...)
    print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
    
    Prints the values to a stream, or to sys.stdout by default.
    Optional keyword arguments:
    file:  a file-like object (stream); defaults to the current sys.stdout.
    sep:   string inserted between values, default a space.
    end:   string appended after the last value, default a newline.
    flush: whether to forcibly flush the stream.
2 Likes