Advertisement
here2share

# lambda_demo.py

Oct 20th, 2019
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.18 KB | None | 0 0
  1. # lambda_demo.py
  2.  
  3. var = [0,1,2,3,4,5]
  4. a = lambda z: (z+1)%len(var)
  5. print a(-1) # 0
  6. print a(0) # 1
  7. print a(1) # 2
  8. print a(2) # 3
  9. print a(5) # 0
  10. var = [0,1,2,3,4]
  11. print a(5) # 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement