What is the "functional" way of doing this?
Tue Jul 31 01:28:44 CEST 2007
beginner <zyzhu2000 at gmail.com> writes:
> def f(n):
> while n>0:
> n /=26
> return l
> I am wondering what is the 'functional' way to do the same.
If you're trying to learn functional programming, maybe you should use
a functional language like Haskell or Scheme. But anyway you might be
thinking of something like:
while n > 0:
n,a = divmod(n, 26)
The above is not really "functional", but it's a reasonably natural
Python style, at least for me.
More information about the Python-list