fork(1) download
  1. from functools import reduce
  2.  
  3. ip = [
  4. ['192.168.1.1','168.95.98.254','168.95.83.70','220.128.2.226','220.128.1.101','168.95.25.13'],
  5. ['192.168.1.1','168.95.98.254','168.95.82.6','220.128.1.6','220.128.1.101','36.226.251.254']
  6. ]
  7.  
  8. nodeDict = {
  9. '192.168.1.1': '0',
  10. '168.95.98.254': '1',
  11. '168.95.83.70': '2',
  12. '220.128.2.226': '3',
  13. '220.128.1.101': '4',
  14. '168.95.25.13': '5',
  15. '168.95.82.6': '6',
  16. '220.128.1.6': '7',
  17. '36.226.251.254': '8'
  18. }
  19.  
  20. def genPath(ipList):
  21. _ = list(map(lambda x: nodeDict.get(x), ipList))
  22. return list("".join(z) for z in zip(_[:-1], _[1:]))
  23.  
  24.  
  25. paths = [genPath(path) for path in ip]
  26. h1 = reduce(lambda x, y: set(x)|set(y), paths)
Success #stdin #stdout 0.01s 27624KB
stdin
Standard input is empty
stdout
{'48', '34', '01', '12', '74', '45', '23', '67', '16'}