http://www.perlmonks.org?node_id=638455


in reply to Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)

This is an imperative solution in Python:

http://pastebin.com/f6a5389b0

- Antonio Ognio, Lima-Peru.