Sorry, I didn't test it. You could add another print before the last line and multiply by m - 3. But notice that the code I wrote is awful and has a terrible performance. I just wanted to point out what awesome things you can do with python.
A good practice will be to solve it with just one for loop. It will have the same time complexity but it implies more math.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
it throws error... but fixed it and the latest is
But how to avoid the unnecessary new line, @protium ?
Sorry, I didn't test it. You could add another print before the last line and multiply by
m - 3
. But notice that the code I wrote is awful and has a terrible performance. I just wanted to point out what awesome things you can do with python.A good practice will be to solve it with just one for loop. It will have the same time complexity but it implies more math.