Advertisement
rfmonk

collections_deque_rotate.py

Jan 10th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. import collections
  5.  
  6. d = collections.deque(xrange(10))
  7. print 'Normal        :', d
  8.  
  9. d = collections.deque(xrange(10))
  10. d.rotate(2)
  11. print 'Right rotation:', d
  12.  
  13. d = collections.deque(xrange(10))
  14. d.rotate(-2)
  15. print 'Left rotation :', d
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement