Skip to content
Advertisement

Tag: dictionary

For every consecutive number

I have a list containing data such as [2, 3, 9, 10, 16, 17, 23, 24, 99, 112, 113, 114, 299] and what I would is that, for every set of consecutive numbers, construct a dictionary with the key representing the set of consecutive numbers starting from 1, and the value the consecutive numbers. The expected output should look like

Advertisement