Jan-11-2019, 03:00 PM
(Jan-11-2019, 02:54 PM)Netopia Wrote: Ok, so groups is a list. And group is a collection of lists based on and named after the last character of the last element.
So ultimately groups becomes a list of lists?
I am afraid not. There are different data structures (containers) in python - these are basic ones, but there are also others, e.g. - in the collections module.
groups is a defaultdict - in simple terms that's a dict (dictionary) with default factor value - in our case - [empty] list.
dict (and also the defaultdict) is a mapping type, i.e. it has key:value pairs. keys are unique. in our case, with the defaultdict we have lists as values.
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