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.
Would it be maybe better to use a .expect("Array is empty") to handle that case for general use?
It's not a best practice though, if there is a unwrap there is no best practice imo
Your solution is correct, unlike the currently highest rated "Best Practices" one (Jan 2025). Floating point maths is not accurate.
the description says the input is always valid
What if there is unicode char as the first element?
What happens if the input is an empty string which is then unwraped?
For anyone wondering why you can use bool as 1 and 0 https://github.com/python/cpython/blob/main/Doc/c-api/bool.rst#id3
Nice one! Got something new for me, thx :)
haha! Nice one
Just Waiting to see this kind of clever solution.
Lean and mean!
Yes. True is 1
great work actually
Beautiful.
Voted "best practices" because it only does as much calculation as necessary, unlike the most popular solution. Well done.
This comment is hidden because it contains spoiler information about the solution
I liked the "str::to_string" part.
Clever!
Loading more items...