0
COULD SOMEONE EXPLAIN WHY THE OUTPUT IS 10?
for a in [1,2,3,4,5]: a+=a print(a)
2 Answers
+ 5
a = 1+1
a = 2+2
a = 3+3
a = 4+4
a = 5+5 <<<10
0
a+=a means "a=a+a"
But you have not take any temp variable to store the previous result. So it just giving you the last result
Here 5+5 =10