Advertisement
Guest User

DRealization

a guest
Dec 14th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. import numpy as np
  2.  
  3. factory_struct = {
  4.     "pipe": [],
  5.     "input": [],
  6.     "pump": [],
  7.     "tank": [5, 6, 7, 8],
  8.     "pipe_c": [],
  9.     "tank_g": [9, 10, 11, 12],
  10.     "stock": [13, 14]
  11. }
  12.  
  13. L = [(1, 5), (2, 6), (3, 7), (4, 8), (5, 9), (5, 10), (6, 10), (6, 11), (7, 9), (7, 11), (8, 12), (9, 13), (10, 13), (11, 14), (12, 14)]
  14.  
  15.  
  16. D = []
  17.  
  18. for i in range(len(L)):
  19.     if L[i][0] in factory_struct["tank"] or L[i][0] in factory_struct["tank_g"] or L[i][0] in factory_struct["stock"]:
  20.         for j in range(i, len(L)):
  21.             if L[i][1] == L[j][0]:
  22.                 D.append((i, j))
  23.  
  24. for item in D:
  25.     print(item)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement