Python coding assistance

a = ‘Python’
b = ‘is a good coding language’
print(a + b)

Output is: Pythonis a good coding language

I want to create a space between “Pythonis”

I am using Thonny IDE

You can change is to

print(a + " " + b)

and thatll add a space

@Eesa is correct.
Alternatively you can add a comma instead of a plus sign.

Like this:

print(a,b)

And Python will add a space automatically as it is the default separator. If you want to modify the default separator you can use the ‘sep’ parameter and pass in a string the separator of your choosing.

Like this:

print(a,b, sep='-')

And that would result in:
Python-is a good coding language
Which I know is not what you want but it’s still cool to know.
Cheers :slight_smile:

1 Like

Hi Essa. Thanks a lot. It worked…

1 Like