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.
The problem states that the array has every integer from 1 to n exactly once except for some integer in between, which appears twice. The array that you're testing on doesn't fit this description (it has a 9 but no 6, for example), so the solution doesn't work.
I tried this with: arr = [1, 5, 7, 3, 2, 9, 2, 8]
And it returned 9 instead of 2 :/
Clever
Agree.
That's right
But if we'll look at tests again we'll see only strings (and lists of strings) as arguments... so IMO we should consider this tast as "strings"-exercise. And treat the task widly, like with real life tasks. IMO again.
Thanks for your solution anyway.
the problem statement did not state that the case you described should return true. I think it's a safe assumption that the author only wanted a True to return if there was an exact match in the list, and false if there are only partial matches or no match at all.
Very clever, but...
In case of a string='bye' and a list=['bye bye'] it will return False
For each step of your list comprehension, you're calculating the sum of proportions. It would be better to calculate it once ahead of time.
input names should strip the trailing underscore