Advertisement
furas

combo i table - set()

Aug 28th, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.66 KB | None | 0 0
  1. combo = [(660, (32, 32, 31), (9, 8, 8)), (660, (32, 32, 31), (9, 8, 8)), (660, (32, 32, 31), (9, 8, 8)), (636, (32, 32, 30), (9, 8, 8)), (636, (32, 32, 30), (9, 8, 8)), (636, (32, 32, 30), (9, 8, 8)), (636, (32, 31, 31), (9, 8, 8)), (636, (32, 31, 31), (9, 8, 8)), (636, (32, 31, 31), (9, 8, 8))]
  2.  
  3. table1 = ((12,27),(13,27),(14,27),(9,27),(8,32),(12,27),(8,27),(13,26))
  4. table2 = ((12,27),(14,27),(9,32) ,(10,28),(8,31),(10,32),(9,28),(9,30))
  5. table3 = ((26,30),(26,26),(26,31))
  6.  
  7. # kolejnosci wedlug elementow z combo
  8.  
  9. for j, a, b in combo:
  10.  
  11.     set_a = set(a)
  12.     set_b = set(b)
  13.    
  14.     for z in table1:
  15.         set_z = set(z)
  16.         if (set_z & set_a) and (set_z & set_b):
  17.             print j, a, b, 'table1', z
  18.  
  19.     for z in table2:
  20.         set_z = set(z)
  21.         if (set_z & set_a) and (set_z & set_b):
  22.             print j, a, b, 'table2', z
  23.  
  24.     for z in table3:
  25.         set_z = set(z)
  26.         if (set_z & set_a) and (set_z & set_b):
  27.             print j, a, b, 'table3', z
  28.  
  29. print '---'
  30.  
  31. # kolejnosci wedlug tablic
  32.  
  33. for z in table1:
  34.     set_z = set(z)
  35.  
  36.     for j, a, b in combo:
  37.         set_a = set(a)
  38.         set_b = set(b)
  39.        
  40.         if (set_z & set_a) and (set_z & set_b):
  41.             print j, a, b, 'table1', z
  42.  
  43. for z in table2:
  44.     set_z = set(z)
  45.  
  46.     for j, a, b in combo:
  47.         set_a = set(a)
  48.         set_b = set(b)
  49.        
  50.         if (set_z & set_a) and (set_z & set_b):
  51.             print j, a, b, 'table2', z
  52.  
  53. for z in table3:
  54.     set_z = set(z)
  55.  
  56.     for j, a, b in combo:
  57.         set_a = set(a)
  58.         set_b = set(b)
  59.        
  60.         if (set_z & set_a) and (set_z & set_b):
  61.             print j, a, b, 'table3', z
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement