Here's the story I have two lists:
list_one=[1,2,9,9,9,3,4,9,9,9,9,2]
list_two=["A","B","C","D","A","E","F","G","H","Word1","Word2"]
I want to find the indicies of consecutive 9's in list_one so that I can get corresponding string from list_two, I've tried:
group_list_one= [(k, sum(1 for i in g),pdn.index(k)) for k,g in groupby(list_one)]
I was hoping to get the index of the first 9 in each tuple and then try to go from there, but that did not work..
What can I do here?? P.S.: I've looked at the documentation of itertools but it seems very vague to me.. Thanks in advance
EDIT: Expected output is (key,occurances,index_of_first_occurance) something like
[(9, 3, 2), (9, 4, 7)]