fork download
  1. data = [
  2. (1, 2, 3),
  3. (4, 5, 6),
  4. (4, 5, 6),
  5. (7, 8, 9)
  6. ]
  7.  
  8. X = [row for row in data if row[0] < 7]
  9. Y = [row for row in data if row[1] == 5]
  10. Z = [row for row in data if row[2] < 6 or row[2] > 6]
  11.  
  12. print("X:")
  13. for row in X:
  14. print(row)
  15.  
  16. print("Y:")
  17. for row in Y:
  18. print(row)
  19.  
  20. print("Z:")
  21. for row in Z:
  22. print(row)
  23.  
Success #stdin #stdout 0.04s 9596KB
stdin
Standard input is empty
stdout
X:
(1, 2, 3)
(4, 5, 6)
(4, 5, 6)
Y:
(4, 5, 6)
(4, 5, 6)
Z:
(1, 2, 3)
(7, 8, 9)