Concatenate two strings using Operator Overloading in Python Last Updated : 10 Jul, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report Operator Overloading refers to using the same operator to perform different tasks by passing different types of data as arguments. To understand how '+' operator works in two different ways in python let us take the following example Python3 # taking two numbers a = 2 b = 3 # using '+' operator add them c = a+b # printing the result print("The sum of these two numbers is ", c) Output: The sum of these two numbers is 5 In this example we used '+' operator to add numbers, now let us take one more example to understand how '+' operator is used to concatenate strings. Python3 # taking two strings from the user a = 'abc' b = 'def' # using '+' operator concatenate them c = a+b # printing the result print("After Concatenation the string becomes", c) Output: After Concatenation the string becomes abcdef For a better understanding of operator overloading, here is an example where a common method is used for both purposes. Python3 # let us define a class with add method class operatoroverloading: def add(self, a, b): self.c = a+b return self.c # creating an object of class obj = operatoroverloading() # using add method by passing integers # as argument result = obj.add(23, 9) print("sum is", result) # using same add method by passing strings # as argument result = obj.add("23", "9") print("Concatenated string is", result) Output: sum is 32 Concatenated string is 239 Comment More infoAdvertise with us Next Article Concatenate two strings using Operator Overloading in Python J jnikita356 Follow Improve Article Tags : Python Python-Operators Practice Tags : pythonpython-operators Similar Reads Operator Overloading in Python Operator Overloading means giving extended meaning beyond their predefined operational meaning. For example operator + is used to add two integers as well as join two strings and merge two lists. It is achievable because '+' operator is overloaded by int class and str class. You might have noticed t 8 min read Python String Concatenation String concatenation in Python allows us to combine two or more strings into one. In this article, we will explore various methods for achieving this. The most simple way to concatenate strings in Python is by using the + operator.Using + OperatorUsing + operator allows us to concatenation or join s 3 min read How to Concatenate Two Lists Index Wise in Python Concatenating two lists index-wise means combining corresponding elements from both lists into a single element, typically a string, at each index . For example, given two lists like a = ["gf", "i", "be"] and b = ["g", "s", "st"], the task is to concatenate each element from a with the corresponding 3 min read How to use String Formatters in Python In Python, we use string formatting to control how text is displayed. It allows us to insert values into strings and organize the output in a clear and readable way. In this article, weâll explore different methods of formatting strings in Python to make our code more structured and user-friendly.Us 3 min read Create multiple copies of a string in Python by using multiplication operator In Python, creating multiple copies of a string can be done in a simple way using multiplication operator. In this article, we will focus on how to achieve this efficiently.Using multiplication operator (*)This method is the easiest way to repeat a string multiple times in Python. It directly gives 1 min read Like