On Wednesday, February 24, 2016 at 1:29:29 AM UTC-5, nkhalasi wrote:
PFA a sample idea.
Naresh babu, what is with all that chaining? You must to be islicing or counting or compressing! ;)
Jokes aside, itertools provides a plethora of functions that let you deal with arbitrary slices/partitions of iterators.
The batteries are include, power up!
- d
PS- Naresh, consider replacement for chain_element, again using iter
def langauge_chain:
from itertools import cycle, islice
chain = cycle(('english', 'spanish', 'german', 'french'))