Concatenation

What is Concatenation?

Text and variables can be concatenated into a larger string (joined together) by using the concatenation operator e.g. print(nameinput + " is " + str(ageinput) + " years old.")

The text inside the quotation marks is the actual text that will be displayed. The + operator joins the data stored in the variables and the actual text together e.g. Freddie is 19 years old, where the name Freddie is stored in the variable NameInput and the age 19 is stored in the variable AgeInput.

The str() function converts the numeric variable into a string.

Concatenation Tutorial Video

SDD 3 Concatenation.mp4

The video above will demonstrate the use of concatenation in Python.

This code below will demonstrate concatenation in Python and can be ran below.