top of page

Concatenation

Data Types: Numbers

Data Types: Strings

Concatenation

Conversion

Data Types: Booleans

Checkpoint

Summary

It can be helpful to concatenate (join) strings together to print statements containing strings stored in variables. The operation for concatenation is the + symbol (just like addition, but between two strings). 

Note that while you can add two numbers (floats or ints) together and you can concatenate two strings together, adding a number to a string will result in an error. 

Let's try concatenating different data types together:

1 name = "Katie" # Try with your own name!

2 print("My name is " + name)

1 ageInYears = 9 # Try with your own age!

2 print("I am " + ageInYears + " years old")

bottom of page