Advertisement
simeonshopov

Odd or Even

May 27th, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. def odd(ll: list):
  2.     return sum(filter(lambda x: x % 2 != 0, ll)) * len(ll)
  3.  
  4.  
  5. def even(ll: list):
  6.     return sum(filter(lambda x: x % 2 == 0, ll)) * len(ll)
  7.  
  8.  
  9. commands = {
  10.     'Odd': odd,
  11.     'Even': even,
  12. }
  13.  
  14. command = input()
  15. numbers = [int(x) for x in input().split()]
  16. print(commands[command](numbers))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement