fork download
  1. import random
  2.  
  3. numbers = []
  4. k = 0
  5.  
  6. for i in range(-10,10):
  7. i = random.randrange(-10,10)
  8. numbers.append(i)
  9.  
  10. print(numbers)
  11.  
  12. print([x * (i % 2) for i,x in enumerate(numbers)])
  13. print([x if i % 2 else 0 for i,x in enumerate(numbers)])
Success #stdin #stdout 0.02s 37616KB
stdin
Standard input is empty
stdout
[1, -8, -6, 9, -6, 9, -5, 3, -5, 6, 7, 9, -6, -1, -5, -5, 9, 9, 4, -7]
[0, -8, 0, 9, 0, 9, 0, 3, 0, 6, 0, 9, 0, -1, 0, -5, 0, 9, 0, -7]
[0, -8, 0, 9, 0, 9, 0, 3, 0, 6, 0, 9, 0, -1, 0, -5, 0, 9, 0, -7]