GroZnik81

Untitled

Oct 29th, 2020
29
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. number = int(input())
  2. numbers = []
  3. filtered = []
  4.  
  5. for i in range(number):
  6. current_numbers = input()
  7. numbers.append(current_numbers)
  8. command = input()
  9.  
  10. if command == "even":
  11. for number in numbers:
  12. if number % 2 == 0:
  13. filtered.append(number)
  14. elif command == "odd":
  15. for number in numbers:
  16. if number % 2 != 0:
  17. filtered.append(number)
  18. elif command == "negative":
  19. for number in numbers:
  20. if number < 0:
  21. filtered.append(number)
  22. elif command == "positive":
  23. for number in numbers:
  24. if number >= 0:
  25. filtered.append(number)
  26. print(filtered)
  27.  
RAW Paste Data