-1
Here is a solution with the map function: res = list(map(lambda i : [i] * len(example[i]), range(len(example)) )) print(res) It's more verbose than the comprehension method, but coming from other languages I prefer it - I find the map to be more explicit and easier to follow,...