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.
Print the input yourself: https://docs.codewars.com/training/troubleshooting/#print-input
This comment is hidden because it contains spoiler information about the solution
What? It's completely fair. The example tests have the correct data. How you manage it it your business. And by the way, please mind your language.
i shouldn't have to deal witht this shit... seriously... all I do is copy-paste from Kata's "example arrays" and suddenly my array is a string.
it's been 2 hours, i deleted my code 6 times, just because of this, it's not fair.... it's just not... if i were stupid and the code would be my fault, i would understand, but having EVERYTHING break because I copy-pasted the sample arrays is just not fair to my time and energy.
Can someone please explain to me how the heck is this a string?
x = [1, 2, 0, 1, 0, 1, 0, 3, 0, 1]
The one below, is NOT a string, but the one above is a string, How is that even possible?
x = [9, 9, 1, 9, 9, 9, 9, 9, 9, 9, 7, 4, 0, 0]
Python, you're drunk...
Approved, thanks!
Python fork with improved tests logs (see discussion just below).
I think now I understand your problem (though I still don't get why your code would fail if it were correct), random tests display things like
testing for validate_pin(157704)
(but alsotesting for validate_pin(xZxS2J?)
, which could have made you understand it was all strings), it would be clearer if the log wastesting for validate_pin('xZxS2J?')
. I'll publish a new fork with this change.This comment is hidden because it contains spoiler information about the solution
???
The description says
If the function is passed a valid PIN string, return true, else return false.
, so I can't see the problem.Also, the title of the kata is
Regex validate PIN Code
. Though the use of regexes is not enforced, regexes only apply to strings.And having a look at sample tests like I told you you would have seen you were passed strings. How would they pass you something like "a234" if it were not a string??
@akar what language is that? Looks scary!
I found the solution. The function input for the variable "pin" is ALWAYS a string... I was considering it any type of input (string, float, int) because the question did not mention anything about this!
That's is why i had special cases for 0000 as integer (for example) which would translate to 0 in a variable... Unlike "0000" which is a string and will stay that way inside a variable.
The exercise should be more precise when asking us to do something :-/ i am not skilled enough to tell from the function itself, it needs to be inside of the exercise phrasing.
I'm not sure to understand your problem but as stated in the description, and as you can see having a look at sample test cases (just under the code editor window), the inputs in this kata are all strings.
307599 - False should equal True
means, necessarily, your function returnsFalse
in this case. And the culprit is your code. This may help you debugging: https://docs.codewars.com/training/troubleshooting/https://docs.codewars.com/training/troubleshooting/#post-discourse
Loading more items...