Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # lambda_demo.py
- var = [0,1,2,3,4,5]
- a = lambda z: (z+1)%len(var)
- print a(-1) # 0
- print a(0) # 1
- print a(1) # 2
- print a(2) # 3
- print a(5) # 0
- var = [0,1,2,3,4]
- print a(5) # 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement