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.
Though I agree that the description could be improved, it is not asking you to write code for the player behavior, just the dealer. In this scenario, the players have already drawn all of their cards, and you simply have to write code for a function that draws cards for the dealer until their total score is 17 or higher, and then returns a list of which players won according to the rules given.
Hey @KiplandDynamite - basically the kata has some input validation tests; at the bottom of the description it's saying "It should throw errors for empty strings or strings which don't represent a decimal number.".
So it's actually up to you and your code to raise a Python error when the input is "invalid" i.e. when the input string is empty, or does not represent a decimal number (which is the case here).
If you are new to Python, or haven't encountered this yet in any case, the way this is done is with the
raise
keyword - you can Google something like "raise exception Python" if you want more details and some examples but basically the syntax is:if (bad condition is True): raise
The Python official docs aren't super helpful with examples, but this site is quite nice https://realpython.com/python-exceptions/ - disclaimer: I'm not paid by/ or endorsing them ;)
This comment is hidden because it contains spoiler information about the solution
What language?
The answer to your first post is yes. About your code, you should print stuff to the console and check whether your code is actually doing what you are expecting.
Look hard at your last if condition.
Yes, follow this guide: https://docs.codewars.com/training/troubleshooting/#post-discourse
I don't know where is the flaw in your code, but you should use
System.out.println
to try to find where your code is bugging.