🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित कोड का आउटपुट क्या होगा?

What will be the output of the following code?


t = (1,2)
print(2*t)

A
(1,2,3,4)
B
(1,2,1,2)
C
(1,1,2,2)
D
(1,1,2,2)
Explanation

t = (1, 2)
print(2 * t)


* जब आप एक tuple को किसी integer से multiply करते हैं, तो वह tuple उसी क्रम में बार-बार दोहराया जाता है।

उदाहरण:
python

2 * (1, 2) → (1, 2, 1, 2)


In English:
Multiplying a tuple by an integer repeats its contents:

python

(1, 2) * 2 = (1, 2, 1, 2)

Correct Answer: B) (1,2,1,2)

Latest Updates