Important Notice:

Concatenation in String

Concatenation in String

4 views 1 min read

Concatenation in String (स्ट्रिंग संयोजन) :-

Concatenation (कंकैटनेशन / स्ट्रिंग संयोजन) वह प्रक्रिया है जिसमें दो या दो से अधिक Strings को जोड़कर एक नई String बनाई जाती है।

Python में String Concatenation के लिए + (Plus) Operator का उपयोग किया जाता है। यह Operator मूल (Original) Strings को बदले बिना एक नई String लौटाता है, क्योंकि Python में Strings Immutable (अपरिवर्तनीय) होती हैं।

English

Concatenation is the process of joining two or more strings to create a new string.

In Python, the + (plus) operator is used for string concatenation. It returns a new string without modifying the original strings because Python strings are immutable.

Syntax (सिंटैक्स) -

new_string = string1 + string2
 
Example 1: Joining Two Strings  :-
first_name = "Rahul"
last_name = "Sharma"

full_name = first_name +last_name

print(full_name)
 
Output-
RahulSharma
 
Example 2: Joining Strings with Space
first_name = "Rahul"
last_name = "Sharma"

full_name = first_name + " " + last_name

print(full_name)
 
Output-
Rahul Sharma
 
 

Related Notes