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.
I consider this clever and readable, not best practice because it technically goes over the list twice, which can be done with one pass in exchange for less readability. Not much overall difference though. Good job.
just four lines
I learned a new way to keep count of a value occurring in an iterator. Thanks!
At this point, I'm beginning my journey in efficient coding and comments like this have helped me to understand time/space complexity and learning algorithms
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
Loading more items...