निम्नलिखित का आउटपुट क्या है?
What is the output of the following ?
x=123
for i in x:
print(i) A
1 2 3
B
123
C
Error
D
None of these
Explanation
The code:
x = 123
for i in x:
print(i)
The issue here is that x = 123 is an integer, and integers are not iterable in Python. You cannot loop through an integer directly like you can with a string, list, or other iterable objects.
So, this will result in an Error.
The correct answer is:
(C) Error
Correct Answer: C) Error