Advertisement
roman_gemini

first half multiplies by 2, second half divides by 2

Jun 10th, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. dbl = lambda x: x << 1  # x * 2
  2. hlf = lambda x: x >> 1  # x / 2
  3.  
  4. f = lambda *a: map(dbl, list(a[:hlf(len(a))])) + map(hlf, list(a[hlf(len(a)):]))
  5.  
  6. print(f(2, 4, 6, 8, 20, 40, 60, 80))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement