8.3 String Concatenation

By | September 29, 2021

To concatenate, or combine, two strings you can use the + operator.

Example

Merge variable a with variable b into variable c:
a = “Hello”
b = “World”
c = a + b
print(c)

Output:
HelloWorld

Example

To add a space between them, add a " ":
a = “Hello”
b = “World”
c = a + ” ” + b
print(c)

Output:
Hello World

Leave a Reply

Your email address will not be published. Required fields are marked *