def to36(q):
 if (q < 0):
  raise ValueError('must supply a positive integer')
 letters = '0123456789abcdefghijklmnopqrstuvwxyz'
 converted = []
 while (q != 0):
  (q, r) = divmod(q, 36)
  converted.insert(0, letters[r])
 return (''.join(converted) or '0')

def to36 ( q ) : if ( q < 0 ) : raise ValueError ( 'must supply a positive integer' ) letters = '0123456789abcdefghijklmnopqrstuvwxyz' converted = [ ] while ( q != 0 ) : ( q , r ) = divmod ( q , 36 ) converted . insert ( 0 , letters [ r ] ) return ( '' . join ( converted ) or '0' )
converts an integer to base 36 .