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.
Bitwise NOTing any number x yields -(x + 1).
This comment is hidden because it contains spoiler information about the solution
the if condition would drop all the 'centenarian (at least 100 years young)' !
just a reminder for those who missed the comment ...
this solution would only work if the term 'teen' is defined as 'any age lower than 20'
aka, would not pass test case such as [5,25,35,45,55,65,75,85,95,105]
thanks. I didn't know naming groups and groupdict()
It is not the triple quoting that allows comments! It is the VERBOSE flag.
I do not understand, what you are trying to say/ask.
sequence(n)
(the function) does not produce a sequence, it produces the number atn-th
position.I.e.
sequence: Z+ -> Z+
Look at examples once more, there is no
2
in the sequence. Not all numbers from 0 to 3 are present in the sequence.Let me see if I'm getting this right, sequence(4) only includes numbers from 0 to 3, not 4 itself.
Then shouldn't sequence(4) return 7 instead of 9? Since 7 wouldn't form arithmic progression with any two numbers from: 0,1,2,3
This comment is hidden because it contains spoiler information about the solution
5
is not in the sequence, as given in the example section. If it was, there would be a progression1, 3, 5
.Thus,
0, 5, 10
is invalid.I'm really lost here... how come sequence(5) should return 10??
Doesn't 0,5,10 form arithmic progression? Shouldn't it be 12 instead??
Also, is the given input part of the sequence or not?
I feel like this kata doesn't give enough examples, could have put in more examples, for example sequence(6), sequence(7).
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I'd never thought of using reduce on this one! Neat!
I see, that's new to me :) Thank you
references for anyone interested:
https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation
https://stackoverflow.com/questions/8006551/how-to-split-long-regular-expression-rules-to-multiple-lines-in-python/8006611
Loading more items...