The Ultimate Cut-and-Paste Job and a JavaScript challenge
The task: Write python code to generate prime_factors
for any integer.
The solution: A one-liner Python program (okay three, if you count the import statements) which get the job done, without actually defining the function. Lo and behold!
The above python code scrapes and selects one of the answers associated with the related Stackoverflow question. The exec
function call eliminates the need for performing the typical cut-and-paste job! How cool is that? That’s why Python rocks!
Incredible, isn’t it? Take it for a spin below:
The JavaScript Challenge
Who will be the first one to write an equivalent Javascript program that does exactly what the Python program does?