Report Bug
Qus :

What will be the output of the following Python code snippet?

a = {}
a[1] = 1
a['1'] = 2
a[1]=a[1]+1
count = 0
for i in a: 
    count += a[i]
print(count)

Qus

निम्नलिखित Python कोड स्निपेट का आउटपुट क्या होगा?

a = {}
a[1] = 1
a['1'] = 2
a[1]=a[1]+1
count = 0
for i in a: 
    count += a[i]
print(count)


A. 1
B. 2
C. 4
D. Error, the keys can’t be a mixture of letters and numbers


Solution
C. 4



Explanation
The above piece of code basically finds the sum of the values of keys.



Report Bug