Answers for "python find two consecutive numbers in list"

1

count consecutive values in python

#count consecutif 1 in list. list exemple l=['1','1','0','1','0','1,'1',1']
cpt=0
    compte=[]
    for i in ch:
        if i=='1':
            cpt +=1
        else:
            compte.append(cpt)
            cpt=0
    compte.append(cpt)
Posted by: Guest on February-28-2021
0

python difference between consecutive element in list

a = [0, 1, 2, 3]
[x - a[i - 1] for i, x in enumerate(a)][1:]
Posted by: Guest on April-16-2021

Code answers related to "python find two consecutive numbers in list"

Python Answers by Framework

Browse Popular Code Answers by Language