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.
I was inspired by this and came up with another interesting, short solution using numpy's rot90: https://www.codewars.com/kata/reviews/5412ed87648162f1e60000c4/groups/6399b331f70c1e000184df8f
You can very easily turn it into pure python by replacing the last line with a function that goes through the return value in reverse order.
This comment is hidden because it contains spoiler information about the solution
Thanks a lot for helping me in my first kata!
Ok, fixed! The single-digit example is there, it's the
9
(the stem is0
).Mostly done, but what do you mean by more random tests? Simply repeat more random tests like the one that is already there?
Thanks a lot!! I fixed those two points.
What is happening inside the hypot?
Your solution does not always work; if you attempt a few times you'll see that it fails sometimes. The problem is that
params.items()
does not guarantee the order of the tuples, so sometimes you get the right order, sometimes you don't. One deterministic right solution is to usecollections.OrderedDict
, for example.Great idea! Also, I like it how you unrolled the tuple, much more readable than mine.
You are correct, but in the end all it does is it skips one iteration (where you would have removed
a
andc
). Not sure if it's an intended skip, but it's actually clever.This comment is hidden because it contains spoiler information about the solution
In
command
you could check ifcmd not in self.cmd
and set it to 0, then you don't need to duplicate the return statement. Or you could simply use adefaultdict(int)
!