Tuesday, 25 November 2008

Last element standing

To access the last element in a list, there's no need for the long-winded list[len(list) - 1].

All that's needed is list[-1].

No comments: