+ 1
How can I find the location of the unique item of more than two lists?
How can I find the location of the unique item of more than two lists? For example: A=[2,3,4,5,6] B=[2,4,5,6,8] C=[3,2] Return B[4] (I am actually making a sudoku solver, and want to use this to locate items)
6 Answers
+ 1
add all lists of block9 into addlist. 
res =list( filter(lambda x: addlist. count(x) ==1,addlist)
 now find the right list.
for l in block 9:
   if res[0] in block9...
0
you can always merge the array first
0
Thanks Jay,
I am not sure if that's going to work.
you know, I numbered the sudoku into 81 cells, and made functions to get all the data out of these cells, and row numbers, column numbers, block numbers and overlapping cells.
So now I am struggling to go to the next level, filtering out the "hidden singles"
(maybe later I want to trace the "naked sets" and "hidden sets" not sure if this is possible for me)
But for now I want an easy way to get the singles out of 9 lists (or sets), and get the cell number and location:
    block: 6
34	['2', '3', '4', '6', '8']
35	['1', '2', '3', '4', '6']
36	[]
43	['2', '4', '6', '8', '9']
44	['2', '4', '6', '9']
45	[]
52	['2', '3', '4', '9']
53	['1', '2', '3', '4', '9']
54	['1', '2', '3', '9']
    block: 7
55	[]
56	[]
57	[]
64	['6']
65	[]
66	[]
73	[]
74	['6', '8']
75	['8', '9']
    block: 8
58	['6', '7', '9']
59	['6', '7', '9']
60	['1', '6', '7']
67	['2', '3', '4', '6', '8', '9']
68	[]
69	['2', '4', '6']
76	['2', '3', '4', '6', '7', '8', '9']
77	['2', '4', '6', '7', '8', '9']
78	['2', '4', '6', '7']
    block: 9
61	['5', '6', '9']
62	[]
63	['6', '9']
70	['2', '3', '4', '6', '9']
71	['2', '3', '4', '6', '9']
72	['2', '3', '6', '9']
79	[]
80	['2', '3', '4', '6', '7', '9']
81	['2', '3', '6', '9']
so, I want to get:
60 --> '1'
61 --> '5'
75 --> '9'
80 --> '7'
or
60 --> [0]
61 --> [0]
75 --> [1]
80 --> [4]
0
Thanks Oma.
But I can't get it working.
is this what you mean:
addlist=[['5', '6', '9'],[],['6', '9'],['2', '3', '4', '6', '9'],['2', '3', '4', '6', '9'],['2', '3', '6', '9'],[],['2', '3', '4', '6', '7', '9'],['2', '3', '6', '9']]
res =list( filter(lambda x: addlist.count(x) ==1,addlist))
0
Wow, Oma!
Thanks that's perfect.
With this I can finish my Sudoku project. 
Thanks you very much






