Python / Q&A · May 6, 2021 0

Python print()

One traditional code beginners should always try is this:

print('Hello World')

This will return “Hello World”.

How it works

The “print()” function returns whatever is inside it. Text inside the quotes will return whatever is inside it (things like print(f’1+1 is {1+1}’) will be explained later.)

Try this one:

print('Hello' + ' World')

Did it print the exact same result? Let me guess: yes! The addition sign makes the two stings merged together. What about this one:

print('Hello', 'World')

It should produce the exact same thing. The comma is basically the addition sign but leaves an extra space before merging the two stings together.