[Tutor] project euler #4

Sibylle Koczian nulla.epistola at web.de
Mon May 11 15:35:29 EDT 2020


Am 11.05.2020 um 20:08 schrieb Mats Wichmann:
> 
> So to Nitish, the OP:  congratulations on taking on the project Euler
> problems, they're really neat.  You've also stumbled on an interesting
> thing that sometimes happens with this list, and in fact any general
> help forum.
> 
> The Euler problems are attempting to teach _mathematical_ concepts
> (encouraging the use of a computer to assist), while where here on the
> list tend to approach problems as ones of what are optimal Python
> approaches.  Just like DL Neil, I immediately thought of solving this by
> using strings, which Python handles very easily. So this replacement
> function works quite nicely, and teaches you nothing about mathematics -
> was that your aim? Or was Python your aim?
> 

Well - does splitting a number into its digits really teach much about 
mathematics, however it is done? But it's needed for several Euler 
problems, so a reusable way to do it, and do it fast, is useful. I'm not 
sure, by the way, which way is faster (division or converting to a 
string) - probably depends on problem details. So best write functions 
for both methods and keep them.

Greetings
Sibylle




More information about the Tutor mailing list