Vidyalelo
Python · Q63

Python Lists MCQs: Exam Practice for List Concepts

Programming · Python · question 63

Q63

What will be the output of the following Python code? names1 = ['Amir', 'Bear', 'Charlton', 'Daman'] names2 = names1 names3 = names1[:] names2[0] = 'Alice' names3[1] = 'Bob' sum = 0 for ls in (names1, names2, names3): if ls[0] == 'Alice': sum += 1 if ls[1] == 'Bob': sum += 10 print sum

A.
11
B.
12
Answer
C.
21
D.
22

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board