Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. nums_amt = int(input())
  2. num_list = list(map(int, input().split()))
  3. new_list = []
  4. zero_cnt = 0
  5. for index in range(nums_amt):
  6.     if num_list[index] != 0:
  7.         new_list.append(num_list[index])
  8.     else:
  9.         zero_cnt += 1
  10. for _ in range(zero_cnt):
  11.     new_list.append(0)
  12. print(*new_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement