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.
This comment is hidden because it contains spoiler information about the solution
Thanks!
Since this hasn't been updated in a year - I've gone ahead and change the parameter name to text.
Since this hasn't been updated in a year - I've gone ahead and added the example tests from the description.
if the first part evaluates to True the second part of an 'or' is not evaluated, either way the whole evaluates to
Yes, I was channeling Jessie's fashion tips from the Fast Show.
Well spotted.
Last line of the kata:
The array will never be empty.
Also 8th kyu kata are introductory, so error handling would be too advanced for this kata.
?
I'm not sure what you are getting at here, but what I can say is:
So in your example, I see two issues:
10b2= 1.1b2 -> 1.1b2 != floor(1.1b2)Please let me know if I have missed your point.
Nice kata, but I think the tests or perhaps the reference solution is broken, I'm seeing the following output (edited to improve readability):
Clearly there is more than one solution with this set of given inputs.
Can I also make a couple of suggestions:
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7, 7, 7]
->[(4, 18), (7, 3)]
[42, 51]
->[(42, 1), (51, 1)]
[93]
->[(93, 1)]
pennies(9, [5, 3, 2])
=>[[5, 2, 2], [3, 3, 3], [3, 2, 2, 2]]
pennies(9, [2, 3, 5])
=>[[2, 2, 5], [3, 3, 3], [2, 2, 2, 3]]
Keep up the good work! :)
Those two tests attempt to use one method first, then attempt to use the other. If the second attempt succeeded without raising an exception, then it is considered a test failure.
Two things worth noting here:
Given that
it
is an iterator on a data structure, rather than a data structure itself. Then both calls should be consuming the same iterator, so I would expect an output of(0, 1), (0, 2)
Anyway, if you write code like this, you're on your own buddy, and you should feel ashamed! :D
OK, I've updated the spec/tests, so now:
Just for the record, yes this is underspecified, it's a simulation of working for an idiot! :D
The point of the kata is implementation of conflicting requirements to do the same thing two different ways at once.
So,
get_next
is required because that is the poor spec that the boss Dave is supplying.The
__next__
and__iter__
are both required to support rest of the world who just want to use an iterable object in the same way as normal Python object and not do. things "Dave's way". :)Iterable is a marker indicating that an object can be ieterated through sequentially. https://docs.python.org/3.8/library/collections.abc.html#collections.abc.Iterable
Unlike Java for example where it comes with a defined interface definition, this just means you're safe to all iter(x) on x.
Loading more items...