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.
It is a tuple. We have used Tuple Indexing here, We know that True value refers to 1 and False refers to 0. So the first element in the tuple is False corresponding to Tuple index zero(false) and the second value is True corresponding to Tuple index one(True)
Still a bit confused. Description says integer arrays so wouldn't this solution fail if the missing element was a 0 or potentially a negative number?
noice
The
i
here is just a number, soi+1
is fine. If you had tried to dolines[i+1]
then you might run into an issue.But also
range(0)
is empty, so no values are computed for empty lists anyway.Hi,
I wrote this code as a starting point but did not expect it to pass all tests.
I do not understand why it works with empty lists.
If lines is an empty list, then len(lines)=0.
So {i+1} should generate an error, shouldn't it ?
thanks :)
technically you are right, please don't write it in real project because use
True
False
over0
1
is really counterintuitive. But programming in codewars is only for educational purpose so this one-linear solution is "the best".Again, don't try it in real project. Readability matters the most in real project.
Hello Garl and all
I'm new to programming, and I'm curious why this would be considered "best practices" as it seems to go agains seveal things I've been told are best practices
Humbly looking to learn,
-DMC
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
if you use more built-in functions then the answer is yes.
what a math genius!
Loading more items...