Flexing, mostly. It's definitely not in this specific kind of situation that these approaches may become useful. But one has to train before jumping from... let's say... the Eiffel tower, and what better place for this than your garden? x)
Are there any advantages to solving the problem this way? Becuase to me it seems needlessly complex, good to learn from, but I'm not sure what it brings to the solution.
Well, I'm not sure about which part you don't understand, so I'll just explain the "non python" part.
First of all, note that this solution won't work in your IDE if you run it on a non Linux/BSD/UNIX system.
Python's prime factorisation utility is in module sympy which is not available in Codewars.
Oddly enough, GNU Core Utils has one (for obscure historical reasons) and our playground is being run on Ubuntu Linux.
It's then just a matter of calling this factor utility from python via subprocess module and parsing the result.
Flexing, mostly. It's definitely not in this specific kind of situation that these approaches may become useful. But one has to train before jumping from... let's say... the Eiffel tower, and what better place for this than your garden? x)
(look at the forks, it's even more flexing ;o )
Are there any advantages to solving the problem this way? Becuase to me it seems needlessly complex, good to learn from, but I'm not sure what it brings to the solution.
Well, I'm not sure about which part you don't understand, so I'll just explain the "non python" part.
First of all, note that this solution won't work in your IDE if you run it on a non Linux/BSD/UNIX system.
Python's prime factorisation utility is in module
sympy
which is not available in Codewars.Oddly enough, GNU Core Utils has one (for obscure historical reasons) and our playground is being run on Ubuntu Linux.
It's then just a matter of calling this
factor
utility from python viasubprocess
module and parsing the result.Can someone explain what this solution is actually doing? I have to say it's beyond my current understanding.