Strings ko Jodna (Concatenation) — text + text

Intro

Ab aap string variable bana sakte ho aur print() kar sakte ho.
Aaj hum ek aur simple power learn karenge: do text ko jodna.
Python me isko concatenation bolte hain—matlab strings ko saath chipkana.


Concept Explanation

WHY (Pehle “kyun”)

Real life me hume messages banana padta hai:

  • “Welcome, Timmy”
  • “Hello, Asha”
  • “My city is Delhi”

Aise sentences banane ke liye hum chhote-chhote strings ko jodte hain.

HOW (Ab “kaise”)

1) + operator strings ke saath bhi kaam karta hai

Jaise numbers me + add karta hai, waise hi strings me + join karta hai.

Example idea:
"basket" + "ball""basketball"

2) Space ka rule (bahut important)

Python “automatic space” nahi deta.
Agar aap chahte ho words ke beech space ho, to space aapko string ke andar hi rakhna hoga.

Example:

  • "Welcome," + "Timmy"Welcome,Timmy (space nahi)
  • "Welcome, " + "Timmy"Welcome, Timmy (space aa gaya)

3) Variables ko bhi jod sakte ho

Aap 2 string variables ko + se jod kar ek naya variable bana sakte ho.

print("basket" + "ball")

Example

Hum greeting aur name ko jodkar ek complete message banayenge.

human_player = "Timmy"
greeting = "Welcome, "

game_welcome = greeting + human_player
print(game_welcome)

Try It Yourself

  1. IDLE open karo → File → New File
  2. 3 variables banao: first_name, last_name, full_name
  3. full_name me first_name + space + last_name jod do
  4. print(full_name) karo
first_name = "Asha"
last_name = "Sharma"

full_name = first_name + " " + last_name
print(full_name)

Summary

Concatenation ka matlab strings ko jodna hai, aur Python me ye + operator se hota hai.
Words ke beech space chahiye to space aapko string ke andar hi dena padta hai.


Next

Next hum dekhenge: string ko repeat kaise karte hain (text * 3).

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top