fork download
  1. import random
  2. l = [random.choice(range(-20,20)) for i in range(20)]
  3. positive = []
  4. negative = []
  5.  
  6. for i, v in enumerate(l):
  7. ([positive, negative][v < 0]).append(i)
  8.  
  9. print(l)
  10. print(positive)
  11. print(negative)
Success #stdin #stdout 0.03s 12320KB
stdin
Standard input is empty
stdout
[-5, 15, -20, -6, -14, 16, 18, -20, 7, 4, 17, 0, -4, -5, -14, -12, -10, 3, -12, -14]
[1, 5, 6, 8, 9, 10, 11, 17]
[0, 2, 3, 4, 7, 12, 13, 14, 15, 16, 18, 19]