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.
Approved
Ruby fix in this kumite (awaiting for approval/rejection)
Done for Python.
Another thing to consider is that the object passed in the
items
parameter may handle indices differently than a standard list (maybe it doesn't support negative indices, for example). In that case, checking thatindex
is between-len(items)
andlen(items)-1
might lead to unexpected behavior.This comment is hidden because it contains spoiler information about the solution
The philosophy that dominates in Python is "It is easier to ask for forgiveness than permission". Many things in Python are implemented through exceptions, including every single iterator. They know when they've reached the end of the data because of a StopIteration exception being raised. They are designed to be performant enough that you can use them without too much worry, as long as the exception condition is still considerably less likely than the exception-free path. As always, it's recommended to use timeit to profile code if a section of code is performance-critical to determine what changes make a significant difference, but in general, a tight try and except block improves the reliability and sometimes the readability of code. Optimizations are being made all the time, and now Python 3.11's patch notes even claim that a try block that doesn't raise an exception is now "zero cost".
description could be better
Thats legit too hard for a 7 kyu im a 5 kyu and even after i hit up google and stackoverflow i didnt get an answer.
I saved so much time by unlocking this solution... I'm currently 6kyu, however this 7kyu kata was a bit hard for me.
I believe it isn't
Python new test framework should be used (Refer this & this for more detail)
Ruby 3.0 should be enabled (Refer this & this for more detail)
I like this kata :)
Ruby translation kumited -- please check and approve
I just did this kata and had a similar solution to those posted(though longer and uglier). It only works for 4 digit prices though. When I ran my solution I came across a bunch of prices with 5 or 3 digits, which messed up my whole algorithm . It was not clear to me that there would be prices of varying length (which make the re pattern more complex and this kata way harder)
Loading more items...