0
Why the output of this code is 2
a={0:1, 1:2} _sum= 0 for b in a: _sum += b Print(_sum)
2 Antworten
+ 3
The output isn't 2, it's 1. Try it in the code playground. _sum is the sum of the keys, i.e. 0 + 1 = 1
Make sure you change 'Print' to 'print' first 😉
0
Well, the result is 1 and not 2