For each number in the list list, the new list will have two members: the first member contains the number in the list list and the second member that comes after the first contains the number of times it appears in the list list. code example
Example: how to select number by twos in a list python next to each
A = [1, 2, 3, 4, 5]
for i in range(len(A) - 1):
value = A[i:i+2]