Posts by João Angelo • 23 points
1 post
-
2
votes2
answers1278
viewsQ: Adding consecutive integers to a list - Python
I have the following code: i = -0 soma = 0 lista = [1,2,3,4] for i in xrage(0,len(lista)): if lista[i] != lista[i+1]: soma += lista[i] i+=1 print soma You’re making the following mistake:…
python-2.7asked João Angelo 23