Examveda

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

C. 21

D. 22

Answer: Option B


This Question Belongs to Python Program >> Lists In Python

Join The Discussion

Related Questions on Lists in Python