fork download
  1. import numpy as np
  2. from itertools import zip_longest
  3.  
  4. #b1 = (array([1, 2], dtype=int64), array([369, 127], dtype=int64), array([0, 0], dtype=int64))
  5. #b2 = (array([2], dtype=int64), array([142], dtype=int64), array([1], dtype=int64))
  6. с1 = [[1, 2], [369, 127], [0, 0]]
  7. с2 = [[2], [142], [1]]
  8.  
  9. def do_this_faggot(first_list, second_list):
  10. r_list=[]
  11. for a1, a2, b1, b2 in zip_longest(first_list[0], first_list[1], second_list[0], second_list[1]):
  12. print("============")
  13. print("combination")
  14. print((a1, a2, b1, b2))
  15. print("============")
  16.  
  17. try:
  18. if a1 == b1 and a2 < b2:
  19. print("============")
  20. print("Element is added")
  21. print((a1, a2, b1, b2))
  22. print("============")
  23.  
  24. r_list.append((a1, a2, b1, b2))
  25. else:
  26. print("============")
  27. print("Element is not added")
  28. print((a1, a2, b1, b2))
  29. print("============")
  30.  
  31. except:
  32. print("============")
  33. print("Element is not added due to None")
  34. print((a1, a2, b1, b2))
  35. print("============")
  36. continue
  37.  
  38. print("=============================================")
  39. print("Results")
  40. print(r_list)
  41. print("=============================================")
  42. return r_list
  43.  
  44.  
  45. do_this_faggot(с1, с2)
  46.  
Success #stdin #stdout 0.18s 27064KB
stdin
Standard input is empty
stdout
============
combination
(1, 369, 2, 142)
============
============
Element is not added
(1, 369, 2, 142)
============
============
combination
(2, 127, None, None)
============
============
Element is not added
(2, 127, None, None)
============
=============================================
Results
[]
=============================================