Advertisement
Guest User

Executing multiple statements with one anonymous function

a guest
Nov 7th, 2013
1,236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.12 KB | None | 0 0
  1. x1 = [5,4,3]
  2. x2 = [7,6,5]
  3. sort_both = lambda: [x1.sort(), x2.sort()]
  4. sort_both() # now x1=[3, 4, 5] and x2=[5, 6, 7]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement