Instead of getting "1,2,3,4,5" in my list i am getting "1,1,2,1,3,1,4,1,5"
Why does it append it that way?!
I have tried changing the ("if" and "elif") to "while" put it still have the bug Here is the code:
c_streak = 1
if len(a_1_list) > 1:
while a_1_list[-1] != [-2]:
streak = 1
if a_1_list[-1] > 0:
p_streaks_list.append(streak)
else: n_streaks_list.append(streak)
break
# This part has the bug
while a_1_list[-1] == a_1_list[-2]:
c_streak += 1
if a_1_list[-1] > 0:
p_streaks_list.append(c_streak)
elif a_1_list[-1] < 0:
n_streaks_list.append(c_streak)
break
# This part has the bug
Instead of getting "1,2,3,4,5" in my list i am getting "1,1,2,1,3,1,4,1,5" Why does it append it that way?! It looks like every new value its attached to a one
Aucun commentaire:
Enregistrer un commentaire