String Concatenation in Python:
We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it. |
(1) String Concatenation means joining two string variables in a program. In string concatenation, + operator concatenation two quoted strings with each other and produce a third string. The concatenation operator is also called an addition operator but we cannot add a string with a number. Because Python does not know how to add a word or string and a number, it says “cannot concatenate str and int objects”. A word that you put in quotes is just a string of letters called a ‘str‘ in python.
(2) Example of String Concatenation in Python as shown below.

(3) In order to create space between the two strings, write the code in the below format.

(4) If you concatenate a string with an integer, you got the following error as shown below.

Comments (No)