Most programming languages allow you to add strings together. This is called string concatenation. You do this with the + operator.
print("Hello" + "World")
Usually this is done with variables:
print("Hi, my name is " + first_name + ".")
Notice, there is a space after "is". Python doesn't put spaces unless you ask for them. If you need to put two spaces in between two variables, make sure you add one:
print("Hi, my name is " + first_name + " " + last_name + ".")Â
Non-strings must be converted to strings before being concatenated with other strings. If you forget, you will get a TypeError.
For example:
print("I am " + age + " years old.") will error if age is an int
print("I am " + str(age) + " years old.") will concatenate and print as intended
Python also allows "string multiplication" by multiplying a string by an int.
For example: "$" * 5 will create the string "$$$$$"