निम्नलिखित का आउटपुट क्या है?
What is the output of the following ?
y = ‘klmn’
for i in range(len(y)):
print(y) A
klmn klmn klmn klmn
B
k
C
k k k
D
None of the these
Explanation
Let's break down the code:
y = 'klmn'
for i in range(len(y)):
print(y)
y = 'klmn'is a string.len(y)is4because the string "klmn" has 4 characters.- The loop runs 4 times (because
range(4)generates the values0, 1, 2, 3). - In each iteration, it prints the entire string
y, which is"klmn".
So the output will be:
klmn
klmn
klmn
klmn
Answer: (A) klmn klmn klmn klmn.
Correct Answer: A) klmn klmn klmn klmn