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.
Good solution bro
here
Doesn't this code do excess work?
i like the use of a comprehension here.
r is a list. If this list if not empty (ie len(r) > 0) then return first element (r[0]). It not then return integer -1
the last line
return r[0] if r else -1
high, I started coding a month ago and couldn't find the answer to my question on google.
what are you telling the computer with this? return R if R exists; if R is not None?
Thanks for the feedback... I didnt real how sloppy was doing it! I was stuck on figuring out the distinction between left and right, so i was printing out the sum for every position until it clicked... I just didnt take the time refine it.
this solution covers less lines but requires multiple calls to a function (sum), although python is wonderful for providing many functions that make our work easier, sometimes you do not have to abuse them.