fork download
  1. l = [1, -1, 0, 42, -228]
  2.  
  3. l1, l2 = [], []
  4. for i, v in enumerate(l):
  5. if v > 0:
  6. l1.append(i)
  7. elif v < 0:
  8. l2.append(i)
  9.  
  10. print(l1, l2)
  11.  
Success #stdin #stdout 0.02s 9936KB
stdin
Standard input is empty
stdout
[0, 3] [1, 4]