Python Strings Concatenation example

In this post, we will study Python Strings Concatenation example. String are very useful in any programming language, so in Python Programming too.  Below we will see how to concatenate two or more Strings in Python.

In Python, Strings can be concatenate with Plus sign +. Let’s see below Python Strings Concatenation example


#Python Strings concatenation Example

str1="Python tutorial "
str2="for beginners"




Python tutorial for beginners



  • Here str1 and str2 are two String when we concatenate str1 and str2 with plus + sign, these strings will merge into one and we store that String into str3.
  • String str3 will also be a String, you can check this by using type() function of Python. when you will write print(type(str3)) result will be <class 'str'>

we can only concatenate Strings using plus operator. If we concatenate String with Integer  using plus, It will throw error.

#Python String concatenation Example

str1="Python tutorial "



TypeError: must be str, not int


Please follow and like us:
READ  Write a program to check Prime number in Python

One Comment to “Python Strings Concatenation example”

  1. […] python if we use plus + sign between two Strings, they will concatenate as we study in Python Strings concatenation example , and if we apply plus operator between two numbers, numbers will […]

Comments are closed.