Advertisement
bl00dt3ars

04. Number Classification

Aug 8th, 2021
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. numbers = input().split(", ")
  2. print(f"Positive: {', '.join([num for num in numbers if int(num) >= 0])}")
  3. print(f"Negative: {', '.join([num for num in numbers if int(num) < 0])}")
  4. print(f"Even: {', '.join([num for num in numbers if int(num) % 2 == 0])}")
  5. print(f"Odd: {', '.join([num for num in numbers if int(num) % 2 != 0])}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement