Is my implementation of happy number OK

Cecil Westerhof Cecil at decebal.nl
Thu Apr 30 21:05:59 CEST 2015


Op Thursday 30 Apr 2015 19:37 CEST schreef Ian Kelly:

Most I still have to digest. ;-)

> On Thu, Apr 30, 2015 at 9:59 AM, Cecil Westerhof <Cecil at decebal.nl> wrote:
>> return (current_array, ''.join(current_array))
>
> You don't seem to be actually using current_array for anything, so
> why not just return the string?

My implementation was not finished. I had intended to make it:
        current_array, \
            current_string = create_current(sum([value ** 2
                                                 for value in current_array]))

But it does not make it significantly faster, so yes, I am going to
return only the string.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof



More information about the Python-list mailing list