Explanation:
๐ข Step 1: Understand the String
"12"
String ke indexes:
Index: 0 1
Value: '1' '2'
So:
"12"[0]
means index 0 ka character:
"12"[0] → "1"
๐ก Step 2: Understand "12"[1]
"12"[1]
Index 1 par character hai:
"12"[1] → "2"
⚠️ Dhyaan rahe: ye "2" string hai, integer 2 nahi.
๐ต Step 3: Convert "2" to Integer
Code:
int("12"[1])
Pehle:
"12"[1] → "2"
Then:
int("2")
becomes:
2
So:
int("12"[1]) → 2
๐ฃ Step 4: String Multiplication
Ab original expression:
"12"[0] * int("12"[1])
Values substitute karo:
"1" * 2
Python mein string ko integer se multiply karne par string repeat hoti hai:
"1" * 2
→ "11"
๐ฏ Step 5: print()
Therefore:
print("11")
✅ Final Output
11


0 Comments:
Post a Comment