+ 1
Can someone explain to me what's wrong with this code? The output should be 20. Sorry for any inconvenience
2 Respuestas
+ 2
Total is initially items[0] which is 3, and in for loop you revisit that 3 again, that's where 23 comes from, instead of 20... Just say total=0 instead of items[0]
+ 2
Thanks, it worked :)