Advertisement
aneliabogeva

Remove Negatives and Reverse

Jun 15th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. values = input()
  2. items = values.split(" ")
  3. list =[]
  4. list_result = []
  5. for i in items:
  6. list += [int(i)]
  7. counter_odd = 0
  8.  
  9. for j in range(len(list)):
  10. if list[j] > 0:
  11. list_result.append(list[j])
  12.  
  13. list_result.reverse()
  14.  
  15. if list_result != []:
  16. for k in list_result:
  17. print(k, end=' ')
  18. else:
  19. print("empty")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement