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.
this is NOT best practice, it modifies given data
This comment is hidden because it contains spoiler information about the solution
My first attempt was to try and return l.reverse(). I kept getting "None" as a result. Can someone explain why you have to do l.reverse() then return l instead of return l.reverse()?
This solution certainly solves the kata.
I only commented because this solution has a number of "best practices" votes.
Per the kata description:
"...a function that takes in a list and returns a list with the revese order."
In a function with that description modifying the passed in list is not "best practices"
If I could cast a down vote for "best practices" I would have done that instead of leaving a comment.
Which solution is "much better" depends on the purpose of reversing the list.
If you're done with the old list, this method is probably better as it doesn't leave the old list in memory. The kata instructions weren't clear about whether the old one needed to be preserved, so either approach should be fine.
This comment is hidden because it contains spoiler information about the solution
This one has the side effect of modifying the passed in list.
I would be much better to copy the list before reversing it.
好机智!
This comment is hidden because it contains spoiler information about the solution