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.
??? The Java equivalent is
null
, like in C# and Javascript. The Void type in Java has no public constructor, so you can't callnew Void()
and you can't return an instance of Void. It's just there to represent thevoid
keyword as something you can interact with.In the execution I copy+pasted the header + log from for the wrong result, it was expecting false, which would have been correct for the arguments it was supposed to be passing according to the header. My function returned true, which was correct for the actual arguments it was given. Even if you don't get it to fail, you can see the arguments it's supposed to pass and the arguments it actually passes are different if you print the arguments.
Doing it in Typescript. The first random test consistently (EDIT: semi-consistently) fails and, going by
console.log
calls, it looks like it's because it's asserting the result of one set of inputs while actually calling the function with a different set.Where my solution begins with:
The first random test fails with
expected true to equal false
, where the first random test's header reads: (wrapped for readability)but the console log reads:
Every other test passes with my current solution.
EDIT: Looking at the logs of the rest of the random tests, regardless of what the test header says they're testing, they all (except the first) have the log output:
The Swift tests are still broken.
The sample tests fail by themselves independent of the solution code: https://i.imgur.com/qwh8jTm.png
The "attempt" random tests expect the wrong results for "8.2M ohms" ( https://i.imgur.com/21Xarxu.png ) and "4.1M ohms". ( https://i.imgur.com/ppBHn61.png )
I did not mean to submit that ~_~ I was trying to get the "attempt" random tests to test with "8.2M ohms", which seems to test for the wrong answer. (At least in the Swift version)
Ah. I completed it for Swift. The tests given for swift require a different format from the tests for every other language.
If the string I provided, which is used as the example, matched the format of the strings actually passed in, it would be
"01|15|59,1|47|6,01|17|20,1|32|34,2|3|17"
The description suggests that times in the strings provided are separated by "
,
", they're actually separated by ",
".In both Java and C#, this can be done easily with overloads:
and C# (although not Java) supports default values using similar syntax to those used in the Python and Ruby versions of this kata:
_What are you talking about? The only overwriting I do there is in declaring constructors.
I decided to do this in Python as a generic solution using classes, just because. If I assign a new instance of my object to a variable at the same level as the function, the random tests seem to be trying to call that variable, and I get this error immediately after the first random test has completed: https://i.imgur.com/Zv65cUY.png (The variable was named "filter" and the class "SmileyFilter")
I like this challenge, but I don't like that it requires division by 0 to return 0 rather than NaN or infinity.
It was always drummed into me that you should absolutely never use float or double for currencies - it seems to me like the signature should really be (int, double, double, int).