[Tutor] working with multiple sets

Alan Gauld alan.gauld at btinternet.com
Wed Sep 9 08:36:42 CEST 2009


"Lie Ryan" <lie.1296 at gmail.com> wrote 

>>> for key, value in sets.items():
>>>         for element in value:
>                try:
>                    lookup[element] = lookup[element].append(key)

This has the same flaw as mine. it nneeds to be
 
                       lookup[element].append(key)

ie no assignment, othewise you just get None stored...

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list