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.
owo recursive, nice
Good point
People commenting you should have stored strings over lists are dumb.
You should have put the same number in your adjacents dictionary though.
That way you can write: "adjacents[observed]" instead of "adjacents[observed] + [observed]"
Goddam that's nerdy
LMAO!!!
python programmers trying their absolute hardest to write all their code in 1 line
I was wondering how I could get this type of solution all on one line. Great code and very readable
@cahyareza
if x < len(s) - 1
is the same as:
if len(s) - x > 1
meaning that the cursor (
x
) has to be before (<
) the last position (len(s) - 1
), in other words at the penultimate position at most, and in this case you want a slice of 2 (s[x:x+2]
);otherwise, if your cursor is at the last position, you want the last character plus an underscore (
s[-1] + "_"
).You are safe since you're stepping 2 by 2 (
in range(0, len(s), >>2<<)
).Also remember that positions start with 0, so each one is "position - 1" (the first one is "1 - 1 = 0", the second one is "2 - 1 = 1", ..., hence the last one is
len(s) - 1
).I actually love this one as it fits better in a functional programming mindset.
ok, thanks
When you post here a solution like you did and don't use spoiler flag, your post is visible on the homepage for anyone to see.
what the fuction?
Please use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
It is kind of to redundant to use a list of strings. A string is already an iterable, so you can just put
'1': '24',
'2': '153,
etc.
See my solution
Loading more items...