Advertisement
Sabev

Remove Negatives and Reverse

Jan 13th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. list_numbers = list(map(int, input().split(' ')))
  2. new_list = []
  3. for a in list_numbers:
  4.  
  5.     if a < 0:
  6.         new_list.append(int(a))
  7.         new_list.remove(a)
  8.     else:
  9.         new_list.append(int(a))
  10. new_list.reverse()
  11. if len(new_list) > 0:
  12.     print(*new_list)
  13. else:
  14.     print("empty")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement