ont

A-Z iterator

ont
Feb 28th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. def sss( n ):
  2.     t = [ 0 ] * n
  3.     while True:
  4.         p, tn = 1, []
  5.         for x in t:
  6.             tn.append( ( x + p ) % 26 )
  7.             p = ( x + p ) / 26
  8.         t = tn
  9.  
  10.         if p:
  11.             raise StopIteration
  12.  
  13.         yield ''.join(reversed([ chr( x + 0x61 ) for x in t ]))
  14.  
  15.  
  16. print len( list(sss( 4 ) ))
Advertisement
Add Comment
Please, Sign In to add comment