How do I get the next value from the list?

I add a new number to the first list and I get this - ["3", "7", "1", "4", "0", "1", "12", "8", "32", "1", "14", "1"]. If the entered number is repeated, then you need to enter the next number from the first list into the second list. That is, if I entered the last number "1", then it should turn out like this ["4", "12", "14"]. The third evening can not solve this problem. Thank you.

What is in the first list?

Show us step by step?

HHJlEcKIwbM

The first list I create myself. I put in numbers. If the entered number matches the number from the first list, then you need to write the next value from the first list into another list.
I hope I correctly state my problem. =)

To restate your problem,
Given two lists, A and B,
derive a list C of indices in List A of items that are also in list B.
From list C and list A, for each item i in list C, such that i < length of list(A),
add to initially empty list D item A(i+1).

List D is the answer.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.