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.
Why are you iterating over array twice? it seems wastefull
beautiful
yeah, probably
isnt replacing len(arr) with arr better
Doesn't work for None
really enjoying this solution.
It doesn't seem to work properly if the function argument is None, count_positives_sum_negatives(None).
the 1 in front of the for turns the temporary variable into a 1. That's necessary because you want to count one by one and not add the content of the array.
it is necessary otherwise for empty list it will return [0,0] rather than []
Well, both bool([]) and len([]) returns False. "if arr" is a more pythonic way than "if len(arr)"
the len() is unnecessary, and looping through twice is unnecessary
It could be enforced by kata author, but it isn't so you'll get all different type of solutions.
That's clever, I knew there was a way to loop once
Interesting, I wonder if replacing the element in 'pos' with a 1 makes a difference performance-wise
just do if arr
Loading more items...