Advertisement
rfmonk

itertools_imap.py

Jan 16th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. from itertools import *
  5.  
  6. print 'Doubles:'
  7. for i in imap(lambda x: 2 * x, xrange(5)):
  8.     print i
  9.  
  10. print 'Multiples:'
  11. for i in imap(lambda x, y: (x, y, x * y), xrange(5), xrange(5, 10)):
  12.     print '%d * %d = %d' % i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement