fork download
  1. # your code goes here
  2. n=int(input())
  3. l=[0]*n
  4. j=0
  5. for i in range(n):
  6. a=int(input())
  7. if(a!=0):
  8. l[j]=a
  9. j+=1
  10. print(l)
Success #stdin #stdout 0.03s 9196KB
stdin
5
4
5
0
6
0 
stdout
[4, 5, 6, 0, 0]