Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import collections
- print 'From the right:'
- d = collections.deque('abcdefg')
- while True:
- try:
- print d.pop(),
- except IndexError:
- break
- print
- print '\nFrom the left:'
- d = collections.deque(xrange(6))
- while True:
- try:
- print d.popleft(),
- except IndexError:
- break
- print
Advertisement
Add Comment
Please, Sign In to add comment