Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
regex wizzards in the house
zero readability. cramming too much functionality into a single line can sometimes sacrifice readability and maintainability of the code. 0/10
So that it will work for
n=0
testThank you. I realized what the problem was. Instead of return in the function I used print...
The fact that your solution worked on your machine does not mean it was correct. Maybe your solution is wrong, and tests on your machine are also wrong and they cannot find the problem? Maybe you do something wrong on your machine, or differently than Codewars does?
"works on my machine" does not prove correctness of anything. To complete a kata on Codewars, it needs to pass tests on Codewars. Working on your machine does not help, and does not prove anything.
Everything worked in my code editor, and this is not the first time...
Your solution with
import math.sqrt
was not accepted most probably because it was not correct. We cannot tell why it was not correct, because we don't know what it was, but most probably it has nothing to do with importing themath.sqrt
, but rather using it incorrectly.Maybe someone knows why when I wanted to import math.sqrt in my solution, my solution was not accepted?
Ok cool, sorry I didn't know...
That's not how it works, your post was visible in the homepage discourse.
Please use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
They do, but then why write purposefully suboptimal code just because the rules of the problem allow it?
I am a beginner and am trying to learn these single line equivalents of my multi-line code. What are these one liners known as? (I just saw somewhere they were mentioned as list comprehensions but I think that was only for the lists.)
Loading more items...