Adding two strings

To add two or more texts with Python, as a developer, I need to use +


A string can be added to another string by simply using a plus:


print( "hello" + " " + "world" )

or with variables:

a = "hello"
b = "world"
print( a + " " + b )

and the output will be the same:

hello world


Note:Remember to also add spaces between the words like + " " +

Also use "hello" and not "Hello", since there is a difference between capital H and a small h!


Python code

Terminal output

Written by: Bartek / Bartlomiej Rohard Warszawski