fork download
  1. from itertools import chain
  2. matrix = [[1,2,3],[4,-5,6],[7,8,9]]
  3. try:
  4. print(next(i for i in chain.from_iterable(matrix) if i < 0))
  5. except StopIteration:
  6. pass
Success #stdin #stdout 0.02s 9108KB
stdin
Standard input is empty
stdout
-5