The challenge is to find the first non-consecutive number in python. I have managed to do it with a library called more_itertools, but the challenge requires that no library be involved. How can I solve it? This is my code:
from more_itertools import consecutive_groups
def first_non_consecutive(l):
g = []
for grp in consecutive_groups(l):
g.append(list(grp))
if len(g) > 1:
return g[1][0]