[Tutor] A dictionary question

Phil phillor9 at gmail.com
Mon Nov 15 15:57:32 EST 2021


On 16/11/21 05:06, Mats Wichmann wrote:
>
> On 11/15/21 01:00, Phil wrote:
>> I think I have to start from scratch.
>>
>> The same pair of numbers has to exist twice in the row set plus each 
>> number (not a pair set) cannot exist in any other row set. That being 
>> the case, I now have to rethink the idea of using a pair list lookup 
>> table which is cumbersome and tedious to debug.
>>
>
> Doesn't sound too bad.
>
> Count how many times the pairs appear in the various elements of your 
> rowlist. I'd probably do something like this:

Thank you Mats,

To find a solution to a problem, a university lecturer was fond of 
telling his first year students to explain the problem to their dog if 
they didn't have anyone else to talk to. This list is my dog and I don't 
always post my questions.

Anyway, I had a bright idea (after I posted my question) that I could 
use a list of dictionaries and make two passes through the row list; 
once to search for pairs and a second time to eliminate those that have 
members that also appear in another set. I had experimented with counter 
from the collections module but ran into problems with counting sets. I 
knew that it worked with tuples but it didn't occur to me to convert the 
set to a tuple.

I'm about to move on from this campsite and I won't have Internet access 
for three or four days, however, I expect to make some progress with 
this project thanks to your reply.

-- 
Regards,
Phil



More information about the Tutor mailing list