ExamVeda
Login
Home
31
What will be the output of the following Python code snippet?
a = [0, 1, 2, 3]
for a[0] in a:
    print(a[0])
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
32
What will be the output of the following Python code?
for i in range(5):
    if i == 5:
        break
    else:
        print(i)
else:
    print("Here")
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
33
What will be the output of the following Python code?
for i in range(10):
    if i == 5:
        break
    else:
        print(i)
else:
    print("Here")
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
34
What will be the output of the following Python code snippet?
string = "my name is x"
for i in ' '.join(string.split()):
    print (i, end=", ")
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
35
What will be the output of the following Python code?
x = (i for i in range(3))
for i in x:
    print(i)
for i in x:
    print(i)
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
36
What will be the output of the following Python code?
string = "my name is x"
for i in string:
    print (i, end=", ")
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
37
What will be the output of the following Python code snippet?
a = [0, 1, 2, 3]
for a[-1] in a:
    print(a[-1])
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
38
What will be the output of the following Python code?
x = (i for i in range(3))
for i in x:
    print(i)
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
39
What will be the output of the following Python code?
string = "my name is x"
for i in string.split():
    print (i, end=", ")
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
40
What will be the output of the following Python code snippet?
a = [0, 1, 2, 3]
i = -2
for i not in a:
    print(i)
    i += 1
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board