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.
You fix the bug, but there is a new bug.
I like the way this solves the problem. Switch/case is such a bulky syntax, and this cleans that up nicely.
@Talrendis Haha, nice one xD
I got it!
I have remembered this 'situation' by a glorious comment from one of community members here commenting some other 8kyu kata:
(you get it? you get it? XD Like, literally returning and literally taking a break XD)
There are no permanent test cases that test empty groups of zeroes. One of my iterations of code would print "thousand" even though it should not have been printed. I recommend adding a test like this:
Test.expect(intToEnglish(3000000000000) == 'three trillion', "'three trillion' expected")
All included tests would pass and i ended up catching the bug with the randomly generated tests. My code would print "three trillion thousand".
I'm pretty sure the kata is trying to exemplify the case of forgetting the break statement. This solution isn't going to be something newbies can pick that up from.
OK, recursion is bad for this.
I solved it in iteration methos.
Exactly.
Too slow in JS and I cannot see a better way for this other than recursion.
When I try (-50) I don't even see the process ends.
How would one begin doing this without using recursion?
Thanks for explaining, that makes sense.
maybe, but what default would make sense here? the (implicit) default case here returns undefined, which i think is appropriate
Shouldn't "best practice" involve a default case?
@GiacomoSorbi
It's quite posible that the Python version is a bit harder then the JS one this is due to the fact that the tests in the Python version can go up to 10000 whereas the JS version has a max of about 1300.
Works now, thanks
Loading more items...