Re: [Tutor] sorted question

2011-01-25 Thread Steven D'Aprano
It't me wrote: Hi all, I'm learning Python with Google's Python class Ik have a question about the following code: = def sort(var): return var[-1] #returns the last character of var Why is the function called "sort" when it doesn't sort? Why not call it "run

Re: [Tutor] sorted question

2011-01-25 Thread Emile van Sebille
On 1/25/2011 11:46 AM It't me said... Hi all, I'm learning Python with Google's Python class Ik have a question about the following code: = def sort(var): return var[-1] #returns the last character of var Nit: it'll be a character if passed in a string of ch

Re: [Tutor] sorted question

2011-01-25 Thread Marc Tompkins
On Tue, Jan 25, 2011 at 11:46 AM, It't me wrote: > Hi all, > > I'm learning Python with Google's Python class > > Ik have a question about the following code: > = > def sort(var): >  return var[-1]  #returns the last character of var > > def sort_last(): >   tup = [

[Tutor] sorted question

2011-01-25 Thread It't me
Hi all, I'm learning Python with Google's Python class Ik have a question about the following code: = def sort(var): return var[-1] #returns the last character of var def sort_last(): tup = [(1, 3), (3, 2), (2, 1)] print(sorted(tup, key=sort)) sort_last() =