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.
im amazed by these one line solutions!
nicely done.
Copy that. Thank you!
not usually best practice, in real life strive for readibility while being able to make your code shorter
I keep forgetting I don't need to make new variables for everything and it can all usually fit inside a return statement. Unsure at my level if that is the best practice, but the fewer lines of code is what I'm currently striving for as I learn.
same hahahaha
How's that going to return [0] if arr is blank though?
why is this best pracice and not without
== 0
and swapeven
andodd
?Thank you Haskell :)
@Avanta Zero is an even number.
same code :D
same lol
Why do I always forget about modulo?
But it's so simple to read lol
I can see how you might have interpreted it that way, but they said "consider it as [0]", not "give your answer as [0]". They're just clarifying that the sum of an empty list is the same as the sum of a one-item list containing only the number zero, (i.e., zero, hence even.)
But in case of an empty list we should return 0, not "even"
Loading more items...