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.
Then if you had a very short message such as "A"(.-) or "I"(..) how can it be possible to discriminate between these two messages, when a . and - can be almost exactly the same length??
Hi, now I see that you didn't get any answer.
(1)
listOf(...).map { ... }.joinToString(...)
is equal
(2)
listOf(...).joinToString(...) { ... }
Intelij simplifying (1) into (2) automatically.
The option is available in traning setup.
Privacy. It is not relevant to this example, but it would be a good choice if the programmer did not want the sub-function to be scoped outside of the current function.
Yes, in this particular kata it can happen that 5 is a very long dot and 6 is a very short dash.
The part of the description you're quoting as about a different thing.
It says that if somewhere in the message
11111
means a dot, then everywhere in that message where11111
is encountered, it would mean a dot, and the same is true for any other sequence.In other words, different number of
1
s can mean a dot, but if something is a dot it's a dot, never dash, and vice versa.That input is for 3 different tests, the first two expect "E" and the last one expects "I", 101 at a slower speed: 110011.
The first case should be
"-3--1"
instead, so no, no ambiguity.high
function so no need to make it accessible everywhere.high
with variables inside it.)Hope that helps :)
It's extremely unpythonic! If I could go back and edit this I would definitely move the
import
statement to the top of the file. (I submitted this solution a few years ago)Edit: Also the indentation on that dictionary -- yuck
The downside of having only one type of connections, is that you cannot avoid performiong a scan of all vertices (persons) to find the connection(s) in the other direction. This impacts the time complexity of the algorithm.
Two-way connections are not a problem as long as you only modify them through methods that update both directions at the same time.
Reworded as requested.
sure. And you just did learn something, didn't you? ;)
errr.... Nope, I disagree. Sorry but it rather sounds like you're not mastering exception usages, that's all.
raise
won't work, for example? Well, I guess the problem is that the original is in JS, where (maybe!) things are a bit different. Maybe changing this tothrow/raise an exception (of any kind)
could be better, then, yes.if badCondition: raise Exception(...)
, period.@Donald: I suggest the small rewording in bullet point 1.
cheers guys.
that's basically what you should do:
but you cannot "test" it that way because raising an exception when the tests do not expect one will... well... OFC raise an exception and stop the test suite completely. So raise it, but only when you should, and absolutely not return something when you should raise an exception.
So, "no issue" situation confirmed. ;p
Loading more items...