Advertisement
kostovhg

Number Classification

Aug 8th, 2021
1,123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. nums = [int(x) for x in input().split(', ')]
  2. cra = {'Positive': lambda x: x >= 0, 'Negative': lambda x: x < 0, 'Even': lambda x: not x % 2, 'Odd': lambda x: x % 2}
  3. [print(f"{c}: {', '.join(str(n) for n in nums if cra[c](n))}") for c in cra.keys()]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement