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.
Please, mention the language you're talking about, there are many for this kata. If it is Python, this is the initial code:
As you can see the names of both functions are ok. Only the var morseCode is using camelCase and should be changed to snake_case. Now, if you talk about the kata description, yes, they are both named in camelCase and the description is shared amongst all languages.
Interesting! The program shouldn't indeed rely on the user not changing the inputs. I updated the code, passing copies of the deck instead of the original array. Thanks for your help :-)
Haha :-) That is awesome! An actual real usecase of the algorithm, I'm a fan :-) Just sent you a message, the password is playingcards ;-)
I did the translation... but I'm not a Python dev so it's almost a "literal" translation from Java, absolutely not in the Python style. It was three years ago and I didn't touch Python at all since then. So I won't be able to help you further I'm afraid.
Altough, I'd be happy to give you the Python solution. So you'll be able to understand where the problem is, and if it's with the Codewars solution, please report it back so we can correct it :-)
I guess if I post it here and mark it as spoiler, you won't be able to see it, so if you give me a link to your public PGP key, I'll encrypt it for you. (https://www.gnupg.org/gph/en/manual/c14.html)
Already 23 people solved this kata in Python though, so it would be a bit surprising if has an error...
Thanks B4B ;-)
Hey tranquility-base, have you succeeded to make your code work? I'm not fluent in Python, and if you say it works, I don't know where to look...
This comment is hidden because it contains spoiler information about the solution
I feel the same about the C# version. I'm not sure when the program is supposed to exit. It passes some tests if it exists when it's processed all the input but not others.
python:
test.assert_equals(user, expected)
java:
assertEquals(expected, user)
(reminder)
Hi,
I confirm that this deck is valid, and it decodes to "ABCTBIPRWRCKCLVR RZLZLRSZYAQ ZPERPLP OOJQUANHA V", as you wrote.
Are you sure your code isn't decoding to None? (Test libraries are annoying, when you write
test.assert_equals(a, b)
for instance, you never know ifa
should be the user's value, or the one it's tested against. I just checked, we should be good here, but better make sure.)Cheers
Thanks, I'm surprised. Never heard that there was a confusion between the two.
"the A B Cs"
And the first letter is never a capital in camelCase.
The first value is not the input, it's what your code returned (and you can see it hasn't all zeroes at the end, so it is wrong). The tests are ok, not a kata issue. Fix your code.