I think I may have found a bug:
pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] pairs.sort(key=lambda pair: pair[1]) pairs
[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]
Should be:
pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] pairs.sort(key=lambda pairs: pairs[1]) pairs
[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')] I have increased the size of the two s's to show the problem. Doug
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor