Editor settings

General settings

Save settings

Learn to program with Python

Concatenating strings with compound addition #

As we can increase the value of the number by using the += operator, we could use the same operator to concatenate strings together, like so:

full_name = ""
full_name += "Fistname" # Equivalent to full_name = full_name + "Firstname"
full_name += " "
full_name += "Lastname"
print(full_name) # Output: Firstname Lastname

Exercise #

  • Create a variable full_name by combining your first and last name together
  • Use the += operator to combine those strings
  • Make sure that there is a space between your first and last name
Output will be displayed here