[Tutor] Sorting tuples

Dave Angel d at davea.name
Thu Jun 21 02:23:52 CEST 2012


On 06/20/2012 07:05 PM, Mike Nickey wrote:
> Hey all,
>
> I'm working through the google classes to increase my python
> understanding and I'm stuck on sorting tuples.
> What is being asked is to sort tuples based on the second element of
> the tuple in ascending order.
>
> Given a list of non-empty tuples, return a list sorted in increasing
> order by the last element in each tuple.

Whoops.  You have a contradictory problem statement.  First you said you
wanted the second element, then you said you wanted the last.

The second element is elem[1], while the last one is elem[-1]    so it's
your choice which part of the spec was the desired one.



-- 

DaveA



More information about the Tutor mailing list