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 did this
since his sum is already declared 0, it will return 0 if list is empty.
Since sum is declared as 0, in case of an empty list it returns 0. Or am i mistaken?
This is what I think the author was looking for, though you might be missing the part about returning 0 if the list is empty.
Thank you so much for the great explanation.
This comment is hidden because it contains spoiler information about the solution
Yep! In Python, there's a way to collapse logic that involves doing actions for every element in a list called "list comprehension". You can see docs online by searching that term or referring to the following example doc: https://www.w3schools.com/python/python_lists_comprehension.asp
Hi, great solution. Sorry to ask, You have used a compound statement right?
I want to learn about this :-)