7 kyu
Lucky Bus Ticket
610 of 1,523akavasin
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
python new test framework is required. updated in this fork
Approved
Random tests mostly expects
False
.See this
Fixed in OP's fork
Hello from Russia with love
Ruby 3.0 should be enabled.
Enabled in this fork
My solution passed sample test for PHP, but it has an error when I pressed "Attempt" What is wrong? I don't get any clear messages or something similar, only this:
"testThatSomethingShouldHappen Failed asserting that false matches expected true. testRandom Failed asserting that false matches expected true."
Any ideas?
Use
echo
to print the input values and check why your code fails.Thx for the reply, but I know how to debug. My solution pass the sample tests, but not work when I press "Attempt". Can I see full test for comparisone results?
Not without solving the kata afaik. That's why I suggested you check the input of the tests that are failing. I've solved it in PHP and the tests aren't bugged.
yes, I get you, thx!
I returned true for "606309" and it said it expected false. please fix. thanks
Btw, I am on ruby.
I fail on the random pass, but it does not show what ticket is failing. Would be nice if you could include that in the debugger. I'm on the PHP version.
My solution passes the test cases but not the 'random test' required to pass. The only feedback I get on that is that 'false doesn't match expected true', so I'm not sure what to change since I don't what ticket is being passed... The only 'true' I'm returning is for tickets that are 6 digits long, and the sum of the first 3 == sum of the last. Anyone know what I'm missing?
took me a while to work out using is_numeric will work now, as it no longer considers hex as acceptable numeric string in PHP 7.-0, so I used ctype_digit instead, which turns out to have been unnecessary.
tests should include tickets of length > 6.
Language?
The test case seems to have characters instead of all digits as mentioned in the description. Offcourse the code can be written to check each character of the ticket string supplied. But this defeats the description of the kata.
Thats true description is misleading but in the examples you can see that function input can contain other characters than digits.
I think I see what you mean. Will the phrase "Consider that input is always a string" be clearer? Or you can propose your own version of the description, so I could improve it.
Yes that would do it,cheers!
Fixed.
PHP translation added.Cool first kata!:)
Python, Ruby and Crystal translations served, cheers :)
Cool! Approved