Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def move_zeros_to_end(input_str):
- integer_list = [int(x) for x in input_str.split(', ')]
- zeros = [x for x in integer_list if x == 0]
- non_zeros = [x for x in integer_list if x != 0]
- result = non_zeros + zeros
- return result
- input_string = input()
- output = move_zeros_to_end(input_string)
- print(output)
Advertisement
Add Comment
Please, Sign In to add comment