Advertisement
here2share

# int2abc.py

Jun 26th, 2019 (edited)
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. # int2abc.py * 17575
  2.    
  3. import string
  4. alpha = string.letters
  5.  
  6. def int2abc(z):
  7.     z = min(z,26*26*26-1)
  8.     c = z/(26*26)%26
  9.     b = z/26%26
  10.     a = z%26
  11.     return ''.join([alpha[z] for z in [c,b,a]])
  12.  
  13.  
  14. print int2abc(0) # aaa
  15. print int2abc(25) # aaz
  16. print int2abc(26) # aba
  17. print int2abc(26*26*26) # zzz
  18. print 26*26*26
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement