Apr-28-2022, 06:59 AM
Just for sake of completeness, to mention
collections.defaultdict
from collections import defaultdict mylist = ["a", "b", "c", "a", "c"] result = defaultdict(list) for idx, item in enumerate(mylist): result[item].append(idx) print(result)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs