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.
Done.
You must return a float, as it appears in the description, you should not expect tests to accept other formats. You can easily make the conversion yourself. This is not a kata issue.
There are even docs about authoring in Python and a couple of pages with authoring guidelines to follow.
I forgot to mention in the above comment:
In order to do the random tests, you'll need to implement your_solution() to the kata in your test code: currently since you only have fixed tests, you are comparing the users returned code to a hard-coded string.
When you implement the random tests, you obviously won't know in advance what the "correct output string" will be. Instead you will have code that looks like this:
Hey @Noksion - I'm a new user also, so nowhere near as knowledgeable as the other users/mods etc. but for what it's worth here's my advice:
Find a kata you've solved recently and look at the Test Cases tab (when you have solved the kata you unlock the ability to view all its Test Cases when you are in the Solutions page).
This will allow you to see how other users have designed and implemented their random tests.
The basic approach for this kata will be that you'll need to generate - say - 50 random strings, each containing a random number (say from 0 to 10) occurences of the sub-string 'heck' - each of these with a random capitalization.
Then you will test the user's solution against each of these 50 random tests.
I hope that helps you get started a bit.
Hey, thanks for your attention to my kata.
I'm new to this, could you please suggest where do I implement random tests and what are the best approaches to this?
Thanks.
duplicate issue
Thanks for letting me know; I realized I had a bug in the test which caused it to terminate early. The shortest solution is indeed unique, and the tester should now reject other solutions as being too long (or not all-resistant).
Oh, good catch --- fixed.
Sorry, I was testing something in the random tests and forgot to add the ''.join(str) back in. It should be fixed now.
A 1d shape, a line, cannot have a hyperperimeter; there simply is no property of the line that could be called a hyperperimeter. The hyperperimeter is one dimension below the hyperarea of the shape, so a hyperperimeter of a line would be measured in meters (or insert other length unit) to the zeroth power - a dimensionless quantity which is always equal to one. A point is a zero-dimensional shape, so its volume is dimensionless, and its hyperperimeter would be measured in meters to the minus one, for example one per meter, even more nonsensical!
There is no value you can assign to the hyperperimeter of a line or to the hyperperimeter or hyperarea of a point because these shapes inherently cannot have these properties, so the only sensible course of action is to return (length, None) or (None, None) in their place.
The general case formula returns the same result as @readerboy7 suggests. If you don't know what the expected result should be, either ask for
None
, or don't use such inputs at all.(None, None)
for empty arrays and(n, None)
for 1-element-long arrays is a terrible choice.Changed so that when n=0 → (None, None) is the solution, and when n=1 → (l, None) is the solution. I did this since my maths teachers couldn't decide what it would be and also due to the little amount of information of the topic on the web. If you can provide me with that says something otherwise as well as citing a credible source online then I promise you I will change it immediately.
resolved
This comment is hidden because it contains spoiler information about the solution
Loading more items...