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.
Your keys might have changed. If the original arrays is
0 => 0
1 => 2
2 => 2
3 => 0
and your array is
0 => 2
1 => 2
4 => 0
5 => 0
the test will expect to see an array with the same values but 0, 1, 2, 3, keys
Yeah, it's a very poor problem statement.
I don't understand this too. It's the same problem that I had.
This comment is hidden because it contains spoiler information about the solution
You are missing a
return
statement at the last line:else: digital_root(x)
. Currently, your code returnsNone
to console.you need a return statement on the last line
It's not about length of lists, it's about their sum. Next time when you post code, please mark it as spoiler and format it properly (link)
It says the sum, not the amount.
Yes, I think that's right.
You're looking for the next larger NUMBER's index, not just smallest index. E.g. [5, 4, 3, 2, 1] and idx 2. By your logic you would return 0, but you should be returning 1, because 3 < 4 < 5. 4 is the least larger number.
Oh yeah. Thanks for the correction.
*
a[i]
( twice )Your error is that the last two lines are finding the smallest index of a number larger than zero instead of the index of the smallest number larger than zero.
same issue here. a few (15 or 17) of the hidden tests are rejected. The visible tests are all OK.
Loading more items...