7 kyu
Tail Swap
2,252 of 5,353mkelty
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.
Java translation ready ! Review it!
C# translation ready! Please review and approve.
Approved! Keep em coming ^^
This comment has been hidden.
Please:
See https://docs.codewars.com/training/troubleshooting/#post-discourse.
Your code is wrong, not a kata issue.
wow i really liked this kata its very good to practice thanks a lot by the way im a beginner i stuck in a lot of problems in a lot of hours sometimes i spend a day to solve one problem tell me what to do to be more advanced and solve 4-5 problems in 1 hour and how can i solve the problem in less time thanks a lot for this kata i really liked it hope u answer
Keep studying and practicing.
Not a kata suggestion. See https://docs.codewars.com/training/troubleshooting/#post-discourse.
how can i be like u please tell me bro
Ruby: move test to 3.0 + RSpec
Approved
JavaScript: use mocha + chai, better assertion messages
Approved
TypeScript translation
Approved
Nice kata
C translation (author gone)
Approved
JS: Node v12 should be used along with the appropriate assertion tools (Mocha + Chai)
Ruby 3.0 should be enabled, read this to learn how to do it
Please organize the structure of test fixture as following (although it has been mentioned in the attached link, I'm repeated here again)
This comment has been hidden.
This comment has been hidden.
Fixed
Thanks man. Just tested it with 2 different solutions and they now pass the tests.
Ruby translation kumited -- please check and approve (note: author is inactive)
Anyone to approve?
Approved
PHP Translation Kumited - please accept :D
.
Javascript translation kumited :)
The testcases in python must be wrong. I can't get this right :( The values after the colon in the testcases don't get swapped...
The testcases for python are correct, your solution must be wrong;-)...
Ok :) will have another go on it. Thanks for the reply.
I run my code in Python on my local machine - and it works, I run the test cases and my solution works, I submit the code and it fails on cases that, when I test, my code suceeds on. This must be broken...
This comment has been hidden.
okay so it looks like the submit solution button for python isn't calling the function, I just rewrote my solution so that it doesn't use the re module and it passes all test cases, but fails when I press "attempt". When I include the value that caused the failure in my test case list, my code passes - so something must be going wrong behind the scenes...
This comment has been hidden.
This comment has been hidden.
I'm not an expert in Python but I think the problem is that you are changing the input array with
strings[0] = a
.strings[1] = b
In javascript the array was copied before given as input. Either way dont ever modify the input(always copy it if its an object or array/list) to the function, that can influence the testing. Hope that was helpfull.
The tests are using the function that you wrote and no more.... if you
import re
outside of the function, it wouldn't get picked up when the function is called in the tests.As @St3f4n wrote above, I believe this is caused by @marcusaurelius's solution modifying the input list. JavaScript version works because the test gives a copy of generated array. I don't recommend modifying the input either, but to prevent further issues like this, I think it's better for the Python tests to also copy the generated list.
Relevant parts of the current tests:
edit: Just tried @marcusaurelius's solution from above and confirmed that it passes all tests if a new list is created and returned (without modifying input list)
This comment has been hidden.
Done and thanks much for the contribution!